2727import static com .google .common .base .MoreObjects .firstNonNull ;
2828import static com .google .common .collect .ImmutableList .toImmutableList ;
2929import static com .google .common .collect .ImmutableMap .toImmutableMap ;
30- import static com .google .common .collect .Maps .immutableEntry ;
3130import static com .google .common .truth .Truth .assertThat ;
32- import static java .util .Map .entry ;
3331import static java .util .function .Function .identity ;
34- import static java .util .stream .Collectors .toUnmodifiableMap ;
3532import static org .mockito .ArgumentMatchers .any ;
3633import static org .mockito .Mockito .times ;
3734import static org .mockito .Mockito .verify ;
@@ -1393,8 +1390,8 @@ public void hashCode_self(AsyncCache<Int, Int> cache, CacheContext context) {
13931390 @ CacheSpec (population = Population .EMPTY ,
13941391 removalListener = { Listener .DISABLED , Listener .REJECTING })
13951392 public void equalsAndHashCodeFail_empty (AsyncCache <Int , Int > cache , CacheContext context ) {
1396- var other = Stream .of (1 , 2 , 3 )
1397- . collect ( toUnmodifiableMap ( Int :: valueOf , key -> Int .futureOf (-key ) ));
1393+ var other = Map .of (Int . valueOf ( 1 ), Int . futureOf (- 1 ),
1394+ Int . valueOf ( 2 ), Int . futureOf (- 2 ), Int . valueOf ( 3 ), Int .futureOf (-3 ));
13981395 assertThat (cache .asMap ().equals (other )).isFalse ();
13991396 assertThat (other .equals (cache .asMap ())).isFalse ();
14001397 assertThat (cache .asMap ().hashCode ()).isNotEqualTo (other .hashCode ());
@@ -1404,10 +1401,9 @@ public void equalsAndHashCodeFail_empty(AsyncCache<Int, Int> cache, CacheContext
14041401 @ Test (dataProvider = "caches" )
14051402 @ CacheSpec (population = { Population .SINGLETON , Population .PARTIAL , Population .FULL },
14061403 removalListener = { Listener .DISABLED , Listener .REJECTING })
1407- public void equalsAndHashCodeFail_present (
1408- AsyncCache <Int , Int > cache , CacheContext context ) {
1409- var other = Stream .of (1 , 2 , 3 )
1410- .collect (toUnmodifiableMap (Int ::valueOf , key -> Int .futureOf (-key )));
1404+ public void equalsAndHashCodeFail_present (AsyncCache <Int , Int > cache , CacheContext context ) {
1405+ var other = Map .of (Int .valueOf (1 ), Int .futureOf (-1 ),
1406+ Int .valueOf (2 ), Int .futureOf (-2 ), Int .valueOf (3 ), Int .futureOf (-3 ));
14111407 assertThat (cache .asMap ().equals (other )).isFalse ();
14121408 assertThat (other .equals (cache .asMap ())).isFalse ();
14131409 assertThat (cache .asMap ().hashCode ()).isNotEqualTo (other .hashCode ());
@@ -2334,7 +2330,7 @@ public void entrySet_contains_nullValue(AsyncCache<Int, Int> cache, CacheContext
23342330 @ Test (dataProvider = "caches" )
23352331 @ CacheSpec (removalListener = { Listener .DISABLED , Listener .REJECTING })
23362332 public void entrySet_contains_absent (AsyncCache <Int , Int > cache , CacheContext context ) {
2337- var entry = entry (context .absentKey (), context .absentValue ().asFuture ());
2333+ var entry = Map . entry (context .absentKey (), context .absentValue ().asFuture ());
23382334 assertThat (cache .asMap ().entrySet ().contains (entry )).isFalse ();
23392335 }
23402336
@@ -2343,7 +2339,7 @@ public void entrySet_contains_absent(AsyncCache<Int, Int> cache, CacheContext co
23432339 @ CacheSpec (population = Population .FULL ,
23442340 removalListener = { Listener .DISABLED , Listener .REJECTING })
23452341 public void entrySet_contains_present (AsyncCache <Int , Int > cache , CacheContext context ) {
2346- var entry = entry (context .firstKey (), cache .asMap ().get (context .firstKey ()));
2342+ var entry = Map . entry (context .firstKey (), cache .asMap ().get (context .firstKey ()));
23472343 assertThat (cache .asMap ().entrySet ().contains (entry )).isTrue ();
23482344 }
23492345
@@ -2352,7 +2348,7 @@ public void entrySet_contains_present(AsyncCache<Int, Int> cache, CacheContext c
23522348 @ Test (dataProvider = "caches" , expectedExceptions = UnsupportedOperationException .class )
23532349 public void entrySet_addIsNotSupported (AsyncCache <Int , Int > cache , CacheContext context ) {
23542350 try {
2355- cache .asMap ().entrySet ().add (immutableEntry (Int .valueOf (1 ), Int .valueOf (2 ).asFuture ()));
2351+ cache .asMap ().entrySet ().add (Map . entry (Int .valueOf (1 ), Int .valueOf (2 ).asFuture ()));
23562352 } finally {
23572353 assertThat (cache ).isEmpty ();
23582354 }
0 commit comments