@@ -39,11 +39,19 @@ public void getForAbsentKey() {
39
39
.get (typeSafeKey ()));
40
40
}
41
41
42
+ @ Test
43
+ public void isEmpty () {
44
+ assertTrue (emptyHMap ().isEmpty ());
45
+ assertFalse (singletonHMap (typeSafeKey (), "foo" ).isEmpty ());
46
+ }
47
+
42
48
@ Test
43
49
public void storesTypeSafeKeyBaseValue () {
44
50
TypeSafeKey .Simple <String > stringKey = typeSafeKey ();
45
- TypeSafeKey <String , Long > longKey = stringKey .andThen (simpleIso (Long ::parseLong , String ::valueOf ));
46
- TypeSafeKey <String , BigInteger > bigIntegerKey = longKey .andThen (simpleIso (BigInteger ::valueOf , BigInteger ::longValue ));
51
+ TypeSafeKey <String , Long > longKey = stringKey .andThen (simpleIso (Long ::parseLong ,
52
+ String ::valueOf ));
53
+ TypeSafeKey <String , BigInteger > bigIntegerKey = longKey .andThen (simpleIso (BigInteger ::valueOf ,
54
+ BigInteger ::longValue ));
47
55
48
56
HMap hMap = singletonHMap (stringKey , "1" );
49
57
assertEquals (just ("1" ), hMap .get (stringKey ));
@@ -54,7 +62,8 @@ public void storesTypeSafeKeyBaseValue() {
54
62
55
63
assertEquals (emptyHMap ().put (longKey , 1L ).get (longKey ), emptyHMap ().put (stringKey , "1" ).get (longKey ));
56
64
assertEquals (emptyHMap ().put (stringKey , "1" ).get (stringKey ), emptyHMap ().put (longKey , 1L ).get (stringKey ));
57
- assertEquals (emptyHMap ().put (stringKey , "1" ).get (stringKey ), emptyHMap ().put (bigIntegerKey , ONE ).get (stringKey ));
65
+ assertEquals (emptyHMap ().put (stringKey , "1" ).get (stringKey ),
66
+ emptyHMap ().put (bigIntegerKey , ONE ).get (stringKey ));
58
67
59
68
assertEquals (singletonHMap (stringKey , "1" ), singletonHMap (longKey , 1L ));
60
69
assertEquals (singletonHMap (stringKey , "1" ), singletonHMap (bigIntegerKey , ONE ));
@@ -82,9 +91,9 @@ public void put() {
82
91
83
92
@ Test
84
93
public void putAll () {
85
- TypeSafeKey <String , String > stringKey1 = typeSafeKey ();
86
- TypeSafeKey <String , String > stringKey2 = typeSafeKey ();
87
- TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
94
+ TypeSafeKey <String , String > stringKey1 = typeSafeKey ();
95
+ TypeSafeKey <String , String > stringKey2 = typeSafeKey ();
96
+ TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
88
97
89
98
HMap left = hMap (stringKey1 , "string value" ,
90
99
intKey , 1 );
@@ -132,9 +141,9 @@ public void removeAll() {
132
141
133
142
@ Test
134
143
public void containsKey () {
135
- TypeSafeKey <String , String > stringKey1 = typeSafeKey ();
136
- TypeSafeKey <String , String > stringKey2 = typeSafeKey ();
137
- TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
144
+ TypeSafeKey <String , String > stringKey1 = typeSafeKey ();
145
+ TypeSafeKey <String , String > stringKey2 = typeSafeKey ();
146
+ TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
138
147
139
148
HMap hMap = singletonHMap (stringKey1 , "string" );
140
149
@@ -158,8 +167,8 @@ public void demandForAbsentKey() {
158
167
@ Test
159
168
@ SuppressWarnings ("serial" )
160
169
public void toMap () {
161
- TypeSafeKey <String , String > stringKey = typeSafeKey ();
162
- TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
170
+ TypeSafeKey <String , String > stringKey = typeSafeKey ();
171
+ TypeSafeKey <Integer , Integer > intKey = typeSafeKey ();
163
172
164
173
assertEquals (new HashMap <TypeSafeKey <?, ?>, Object >() {{
165
174
put (stringKey , "string" );
@@ -192,14 +201,14 @@ public void values() {
192
201
193
202
@ Test
194
203
public void convenienceStaticFactoryMethods () {
195
- TypeSafeKey .Simple <String > stringKey = typeSafeKey ();
196
- TypeSafeKey .Simple <Integer > intKey = typeSafeKey ();
197
- TypeSafeKey .Simple <Float > floatKey = typeSafeKey ();
198
- TypeSafeKey .Simple <Byte > byteKey = typeSafeKey ();
199
- TypeSafeKey .Simple <Short > shortKey = typeSafeKey ();
200
- TypeSafeKey .Simple <Long > longKey = typeSafeKey ();
201
- TypeSafeKey .Simple <Double > doubleKey = typeSafeKey ();
202
- TypeSafeKey .Simple <Character > charKey = typeSafeKey ();
204
+ TypeSafeKey .Simple <String > stringKey = typeSafeKey ();
205
+ TypeSafeKey .Simple <Integer > intKey = typeSafeKey ();
206
+ TypeSafeKey .Simple <Float > floatKey = typeSafeKey ();
207
+ TypeSafeKey .Simple <Byte > byteKey = typeSafeKey ();
208
+ TypeSafeKey .Simple <Short > shortKey = typeSafeKey ();
209
+ TypeSafeKey .Simple <Long > longKey = typeSafeKey ();
210
+ TypeSafeKey .Simple <Double > doubleKey = typeSafeKey ();
211
+ TypeSafeKey .Simple <Character > charKey = typeSafeKey ();
203
212
204
213
HMap m1 = emptyHMap ().put (stringKey , "string value" );
205
214
HMap m2 = m1 .put (intKey , 1 );
0 commit comments