@CollectionFeature.Require(SUPPORTS_REMOVE) public void testRemove_occurrences_wrongType() { assertEquals( "multiset.remove(wrongType, 1) didn't return 0", 0, getMultiset().remove(WrongType.VALUE, 1)); }
public void testContainsAll_wrongType() { Collection<WrongType> wrong = MinimalCollection.of(WrongType.VALUE); try { assertFalse( "containsAll(wrongType) should return false or throw", collection.containsAll(wrong)); } catch (ClassCastException tolerated) { } }
@CollectionFeature.Require(SUPPORTS_REMOVE) public void testRemove_wrongType() { try { assertFalse(collection.remove(WrongType.VALUE)); } catch (ClassCastException tolerated) { } expectUnchanged(); }
public void testContains_wrongType() { try { //noinspection SuspiciousMethodCalls assertFalse( "containsValue(wrongType) should return false or throw", getMap().containsValue(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testContains_wrongType() { try { //noinspection SuspiciousMethodCalls assertFalse( "containsKey(wrongType) should return false or throw", getMap().containsKey(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
@MapFeature.Require(SUPPORTS_REMOVE) public void testRemove_wrongType() { try { assertNull(getMap().remove(WrongType.VALUE)); } catch (ClassCastException tolerated) { } expectUnchanged(); }
@CollectionFeature.Require(SUPPORTS_REMOVE) public void testRemoveAll_containsWrongType() { try { assertFalse( "removeAll(containsWrongType) should return false or throw", collection.removeAll(MinimalCollection.of(WrongType.VALUE))); } catch (ClassCastException tolerated) { } expectUnchanged(); }
public void testContains_wrongType() { try { assertFalse( "contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testFind_wrongType() { try { assertEquals( getMethodName() + "(wrongType) should return -1 or throw", -1, find(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testGet_wrongType() { try { assertEquals("getOrDefault(wrongType, default) should return default or throw", v3(), getMap().getOrDefault(WrongType.VALUE, v3())); } catch (ClassCastException tolerated) { } }
@CollectionSize.Require(absent = ZERO) public void testToArray_emptyArrayOfWrongTypeForNonEmptyCollection() { try { WrongType[] array = new WrongType[0]; collection.toArray(array); fail("toArray(notAssignableTo[]) should throw"); } catch (ArrayStoreException expected) { } }
@CollectionSize.Require(ZERO) public void testToArray_emptyArrayOfWrongTypeForEmptyCollection() { WrongType[] array = new WrongType[0]; assertSame( "toArray(sameSizeNotAssignableTo[]) should return the given array", array, collection.toArray(array)); }
public void testContainsAll_wrongType() { Collection<WrongType> wrong = MinimalCollection.of(WrongType.VALUE); try { assertFalse("containsAll(wrongType) should return false or throw", collection.containsAll(wrong)); } catch (ClassCastException tolerated) { } }
public void testContains_wrongType() { try { //noinspection SuspiciousMethodCalls assertFalse("containsValue(wrongType) should return false or throw", getMap().containsValue(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testContains_wrongType() { try { //noinspection SuspiciousMethodCalls assertFalse("containsKey(wrongType) should return false or throw", getMap().containsKey(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
@CollectionFeature.Require(SUPPORTS_REMOVE) public void testRemoveAll_containsWrongType() { try { assertFalse("removeAll(containsWrongType) should return false or throw", collection.removeAll(MinimalCollection.of(WrongType.VALUE))); } catch (ClassCastException tolerated) { } expectUnchanged(); }
public void testContains_wrongType() { try { assertFalse("contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testFind_wrongType() { try { assertEquals(getMethodName() + "(wrongType) should return -1 or throw", -1, find(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }
public void testGet_wrongType() { try { assertNull("get(wrongType) should return null or throw", getMap().get(WrongType.VALUE)); } catch (ClassCastException tolerated) { } }