@Override @Test(expected = NoSuchElementException.class) public void minBy() { ImmutableMap<Integer, String> map = this.classUnderTest(); map.minBy(Functions.getStringPassThru()); }
@Override @Test(expected = NoSuchElementException.class) public void min() { ImmutableMap<Integer, String> map = this.classUnderTest(); map.min(); }
@Override @Test public void anySatisfy() { ImmutableMap<Integer, String> map = this.classUnderTest(); Assert.assertFalse(map.anySatisfy(String.class::isInstance)); Assert.assertFalse(map.anySatisfy("Monkey"::equals)); }
@Override @Test public void noneSatisfy() { ImmutableMap<Integer, String> map = this.classUnderTest(); Assert.assertTrue(map.noneSatisfy(Integer.class::isInstance)); Assert.assertTrue(map.noneSatisfy("Monkey"::equals)); }
@Override @Test public void ifPresentApply() { Integer absentKey = this.size() + 1; ImmutableMap<Integer, String> classUnderTest = this.classUnderTest(); Assert.assertNull(classUnderTest.ifPresentApply(absentKey, Functions.getPassThru())); }
@Override @Test public void getIfAbsent() { Integer absentKey = this.size() + 1; String absentValue = String.valueOf(absentKey); // Absent key behavior ImmutableMap<Integer, String> classUnderTest = this.classUnderTest(); Assert.assertEquals(absentValue, classUnderTest.getIfAbsentValue(absentKey, absentValue)); // Still unchanged Assert.assertEquals(this.equalUnifiedMap(), classUnderTest); }
@Override @Test public void testToString() { ImmutableMap<Integer, String> map = this.classUnderTest(); Assert.assertEquals("{}", map.toString()); }
@Override public void detect() { ImmutableMap<Integer, String> map = this.classUnderTest(); Assert.assertNull(map.detect((ignored1, ignored2) -> true)); }
@Override public void reject() { ImmutableMap<Integer, String> map = this.classUnderTest(); ImmutableMap<Integer, String> actual = map.reject((ignored1, ignored2) -> false); Verify.assertInstanceOf(ImmutableEmptyMapWithHashingStrategy.class, actual); }