21
21
22
22
import com .google .common .collect .ImmutableMap ;
23
23
import com .google .common .collect .ImmutableSet ;
24
- import com .google .common .truth .Truth8 ;
25
24
import org .junit .Test ;
26
25
import org .junit .runner .RunWith ;
27
26
import org .junit .runners .JUnit4 ;
@@ -38,10 +37,10 @@ public void parseAndGetStringValue() {
38
37
.parseFlag ("-XepOpt:Other:Arg:More:Parts=Long" )
39
38
.parseFlag ("-XepOpt:EmptyArg=" )
40
39
.build ();
41
- Truth8 . assertThat (flags .get ("SomeArg" )).hasValue ("SomeValue" );
42
- Truth8 . assertThat (flags .get ("Other:Arg:More:Parts" )).hasValue ("Long" );
43
- Truth8 . assertThat (flags .get ("EmptyArg" )).hasValue ("" );
44
- Truth8 . assertThat (flags .get ("absent" )).isEmpty ();
40
+ assertThat (flags .get ("SomeArg" )).hasValue ("SomeValue" );
41
+ assertThat (flags .get ("Other:Arg:More:Parts" )).hasValue ("Long" );
42
+ assertThat (flags .get ("EmptyArg" )).hasValue ("" );
43
+ assertThat (flags .get ("absent" )).isEmpty ();
45
44
}
46
45
47
46
@ Test
@@ -54,17 +53,17 @@ public void parseAndGetBoolean() {
54
53
.parseFlag ("-XepOpt:Arg3=yes" )
55
54
.parseFlag ("-XepOpt:Arg4" )
56
55
.build ();
57
- Truth8 . assertThat (flags .getBoolean ("Arg1" )).hasValue (true );
58
- Truth8 . assertThat (flags .getBoolean ("Arg2" )).hasValue (false );
56
+ assertThat (flags .getBoolean ("Arg1" )).hasValue (true );
57
+ assertThat (flags .getBoolean ("Arg2" )).hasValue (false );
59
58
assertThrows (IllegalArgumentException .class , () -> flags .getBoolean ("Arg3" ));
60
- Truth8 . assertThat (flags .getBoolean ("Arg4" )).hasValue (true );
61
- Truth8 . assertThat (flags .getBoolean ("absent" )).isEmpty ();
59
+ assertThat (flags .getBoolean ("Arg4" )).hasValue (true );
60
+ assertThat (flags .getBoolean ("absent" )).isEmpty ();
62
61
}
63
62
64
63
@ Test
65
64
public void parseAndGetImplicitTrue () {
66
65
ErrorProneFlags flags = ErrorProneFlags .builder ().parseFlag ("-XepOpt:SomeArg" ).build ();
67
- Truth8 . assertThat (flags .getBoolean ("SomeArg" )).hasValue (true );
66
+ assertThat (flags .getBoolean ("SomeArg" )).hasValue (true );
68
67
}
69
68
70
69
@ Test
@@ -75,10 +74,10 @@ public void parseAndGetInteger() {
75
74
.parseFlag ("-XepOpt:Arg2=20.6" )
76
75
.parseFlag ("-XepOpt:Arg3=thirty" )
77
76
.build ();
78
- Truth8 . assertThat (flags .getInteger ("Arg1" )).hasValue (10 );
77
+ assertThat (flags .getInteger ("Arg1" )).hasValue (10 );
79
78
assertThrows (NumberFormatException .class , () -> flags .getInteger ("Arg2" ));
80
79
assertThrows (NumberFormatException .class , () -> flags .getInteger ("Arg3" ));
81
- Truth8 . assertThat (flags .getInteger ("absent" )).isEmpty ();
80
+ assertThat (flags .getInteger ("absent" )).isEmpty ();
82
81
}
83
82
84
83
@ Test
@@ -145,13 +144,13 @@ public void enumFlags() {
145
144
.parseFlag ("-XepOpt:CaseInsensitiveColours=yellow,green" )
146
145
.parseFlag ("-XepOpt:EmptyColours=" )
147
146
.build ();
148
- Truth8 . assertThat (flags .getEnum ("Colour" , Colour .class )).hasValue (Colour .RED );
149
- Truth8 . assertThat (flags .getEnumSet ("Colours" , Colour .class ))
147
+ assertThat (flags .getEnum ("Colour" , Colour .class )).hasValue (Colour .RED );
148
+ assertThat (flags .getEnumSet ("Colours" , Colour .class ))
150
149
.hasValue (ImmutableSet .of (Colour .YELLOW , Colour .GREEN ));
151
- Truth8 . assertThat (flags .getEnumSet ("CaseInsensitiveColours" , Colour .class ))
150
+ assertThat (flags .getEnumSet ("CaseInsensitiveColours" , Colour .class ))
152
151
.hasValue (ImmutableSet .of (Colour .YELLOW , Colour .GREEN ));
153
- Truth8 . assertThat (flags .getEnumSet ("EmptyColours" , Colour .class )).hasValue (ImmutableSet .of ());
154
- Truth8 . assertThat (flags .getEnumSet ("NoSuchColours" , Colour .class )).isEmpty ();
152
+ assertThat (flags .getEnumSet ("EmptyColours" , Colour .class )).hasValue (ImmutableSet .of ());
153
+ assertThat (flags .getEnumSet ("NoSuchColours" , Colour .class )).isEmpty ();
155
154
}
156
155
157
156
@ Test
0 commit comments