1 package org.apache.maven.scm.provider.accurev.cli;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.hamcrest.Matchers.is;
23 import static org.junit.Assert.assertThat;
24
25 import org.junit.Test;
26
27 public class AuthTokenConsumerTest
28 {
29
30 @Test
31 public void testConsumeLineWithPasswordPrefix()
32 {
33 AuthTokenConsumer consumer = new AuthTokenConsumer();
34 consumer.consumeLine( "Password: abcdef123456" );
35 assertThat( consumer.getAuthToken(), is( "abcdef123456" ) );
36
37 consumer.consumeLine( "A different line" );
38 assertThat( consumer.getAuthToken(), is( "abcdef123456" ) );
39 }
40
41 @Test
42 public void testConsumeLineWithoutPasswordPrefix()
43 {
44 AuthTokenConsumer consumer = new AuthTokenConsumer();
45 consumer.consumeLine( "abcdef123456" );
46 assertThat( consumer.getAuthToken(), is( "abcdef123456" ) );
47
48 consumer.consumeLine( "A different line" );
49 assertThat( consumer.getAuthToken(), is( "abcdef123456" ) );
50 }
51
52 }