44import static org .junit .jupiter .api .Assertions .assertFalse ;
55import static org .junit .jupiter .api .Assertions .assertNull ;
66import static org .junit .jupiter .api .Assertions .assertTrue ;
7+
78import org .junit .jupiter .api .Test ;
89
910class ImmutableHashMapTest {
1011
1112 @ Test
1213 void testEmptyMap () {
13- ImmutableHashMap <String , Integer > map
14- = ImmutableHashMap .<String , Integer >empty ();
14+ ImmutableHashMap <String , Integer > map = ImmutableHashMap .<String , Integer >empty ();
1515
1616 assertEquals (0 , map .size ());
1717 assertNull (map .get ("A" ));
1818 }
1919
2020 @ Test
2121 void testPutDoesNotModifyOriginalMap () {
22- ImmutableHashMap <String , Integer > map1
23- = ImmutableHashMap .<String , Integer >empty ();
22+ ImmutableHashMap <String , Integer > map1 = ImmutableHashMap .<String , Integer >empty ();
2423
2524 ImmutableHashMap <String , Integer > map2 = map1 .put ("A" , 1 );
2625
@@ -32,10 +31,7 @@ void testPutDoesNotModifyOriginalMap() {
3231
3332 @ Test
3433 void testMultiplePuts () {
35- ImmutableHashMap <String , Integer > map
36- = ImmutableHashMap .<String , Integer >empty ()
37- .put ("A" , 1 )
38- .put ("B" , 2 );
34+ ImmutableHashMap <String , Integer > map = ImmutableHashMap .<String , Integer >empty ().put ("A" , 1 ).put ("B" , 2 );
3935
4036 assertEquals (2 , map .size ());
4137 assertEquals (1 , map .get ("A" ));
@@ -44,19 +40,15 @@ void testMultiplePuts() {
4440
4541 @ Test
4642 void testContainsKey () {
47- ImmutableHashMap <String , Integer > map
48- = ImmutableHashMap .<String , Integer >empty ()
49- .put ("X" , 100 );
43+ ImmutableHashMap <String , Integer > map = ImmutableHashMap .<String , Integer >empty ().put ("X" , 100 );
5044
5145 assertTrue (map .containsKey ("X" ));
5246 assertFalse (map .containsKey ("Y" ));
5347 }
5448
5549 @ Test
5650 void testNullKey () {
57- ImmutableHashMap <String , Integer > map
58- = ImmutableHashMap .<String , Integer >empty ()
59- .put (null , 50 );
51+ ImmutableHashMap <String , Integer > map = ImmutableHashMap .<String , Integer >empty ().put (null , 50 );
6052
6153 assertEquals (50 , map .get (null ));
6254 }
0 commit comments