Java Code Examples for com.google.common.collect.testing.WrongType

The following are top voted examples for showing how to use com.google.common.collect.testing.WrongType. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: guava-mock   File: MultisetRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_occurrences_wrongType() {
  assertEquals(
      "multiset.remove(wrongType, 1) didn't return 0",
      0,
      getMultiset().remove(WrongType.VALUE, 1));
}
 
Example 2
Project: guava-mock   File: CollectionContainsAllTester.java   View source code 5 votes vote down vote up
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) {
  }
}
 
Example 3
Project: guava-mock   File: CollectionRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertFalse(collection.remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 4
Project: guava-mock   File: MapContainsValueTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse(
        "containsValue(wrongType) should return false or throw",
        getMap().containsValue(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 5
Project: guava-mock   File: MapContainsKeyTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse(
        "containsKey(wrongType) should return false or throw",
        getMap().containsKey(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 6
Project: guava-mock   File: MapRemoveTester.java   View source code 5 votes vote down vote up
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertNull(getMap().remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 7
Project: guava-mock   File: CollectionRemoveAllTester.java   View source code 5 votes vote down vote up
@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();
}
 
Example 8
Project: guava-mock   File: CollectionContainsTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    assertFalse(
        "contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 9
Project: guava-mock   File: AbstractListIndexOfTester.java   View source code 5 votes vote down vote up
public void testFind_wrongType() {
  try {
    assertEquals(
        getMethodName() + "(wrongType) should return -1 or throw", -1, find(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 10
Project: guava-mock   File: MapGetOrDefaultTester.java   View source code 5 votes vote down vote up
public void testGet_wrongType() {
  try {
    assertEquals("getOrDefault(wrongType, default) should return default or throw",
        v3(), getMap().getOrDefault(WrongType.VALUE, v3()));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 11
Project: guava-mock   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@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) {
  }
}
 
Example 12
Project: guava-mock   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@CollectionSize.Require(ZERO)
public void testToArray_emptyArrayOfWrongTypeForEmptyCollection() {
  WrongType[] array = new WrongType[0];
  assertSame(
      "toArray(sameSizeNotAssignableTo[]) should return the given array",
      array,
      collection.toArray(array));
}
 
Example 13
Project: googles-monorepo-demo   File: MultisetRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_occurrences_wrongType() {
  assertEquals(
      "multiset.remove(wrongType, 1) didn't return 0",
      0,
      getMultiset().remove(WrongType.VALUE, 1));
}
 
Example 14
Project: googles-monorepo-demo   File: CollectionContainsAllTester.java   View source code 5 votes vote down vote up
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) {
  }
}
 
Example 15
Project: googles-monorepo-demo   File: CollectionRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertFalse(collection.remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 16
Project: googles-monorepo-demo   File: MapContainsValueTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse(
        "containsValue(wrongType) should return false or throw",
        getMap().containsValue(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 17
Project: googles-monorepo-demo   File: MapContainsKeyTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse(
        "containsKey(wrongType) should return false or throw",
        getMap().containsKey(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 18
Project: googles-monorepo-demo   File: MapRemoveTester.java   View source code 5 votes vote down vote up
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertNull(getMap().remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 19
Project: googles-monorepo-demo   File: CollectionRemoveAllTester.java   View source code 5 votes vote down vote up
@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();
}
 
Example 20
Project: googles-monorepo-demo   File: CollectionContainsTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    assertFalse(
        "contains(wrongType) should return false or throw", collection.contains(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 21
Project: googles-monorepo-demo   File: AbstractListIndexOfTester.java   View source code 5 votes vote down vote up
public void testFind_wrongType() {
  try {
    assertEquals(
        getMethodName() + "(wrongType) should return -1 or throw", -1, find(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 22
Project: googles-monorepo-demo   File: MapGetOrDefaultTester.java   View source code 5 votes vote down vote up
public void testGet_wrongType() {
  try {
    assertEquals("getOrDefault(wrongType, default) should return default or throw",
        v3(), getMap().getOrDefault(WrongType.VALUE, v3()));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 23
Project: googles-monorepo-demo   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@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) {
  }
}
 
Example 24
Project: googles-monorepo-demo   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@CollectionSize.Require(ZERO)
public void testToArray_emptyArrayOfWrongTypeForEmptyCollection() {
  WrongType[] array = new WrongType[0];
  assertSame(
      "toArray(sameSizeNotAssignableTo[]) should return the given array",
      array,
      collection.toArray(array));
}
 
Example 25
Project: guava-libraries   File: CollectionContainsAllTester.java   View source code 5 votes vote down vote up
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) {
  }
}
 
Example 26
Project: guava-libraries   File: CollectionRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertFalse(collection.remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 27
Project: guava-libraries   File: MapContainsValueTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse("containsValue(wrongType) should return false or throw",
        getMap().containsValue(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 28
Project: guava-libraries   File: MapContainsKeyTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    //noinspection SuspiciousMethodCalls
    assertFalse("containsKey(wrongType) should return false or throw",
        getMap().containsKey(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 29
Project: guava-libraries   File: MapRemoveTester.java   View source code 5 votes vote down vote up
@MapFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertNull(getMap().remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}
 
Example 30
Project: guava-libraries   File: CollectionRemoveAllTester.java   View source code 5 votes vote down vote up
@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();
}
 
Example 31
Project: guava-libraries   File: CollectionContainsTester.java   View source code 5 votes vote down vote up
public void testContains_wrongType() {
  try {
    assertFalse("contains(wrongType) should return false or throw",
        collection.contains(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 32
Project: guava-libraries   File: AbstractListIndexOfTester.java   View source code 5 votes vote down vote up
public void testFind_wrongType() {
  try {
    assertEquals(getMethodName() + "(wrongType) should return -1 or throw",
        -1, find(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 33
Project: guava-libraries   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@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) {
  }
}
 
Example 34
Project: guava-libraries   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@CollectionSize.Require(ZERO)
public void testToArray_emptyArrayOfWrongTypeForEmptyCollection() {
  WrongType[] array = new WrongType[0];
  assertSame(
      "toArray(sameSizeNotAssignableTo[]) should return the given array",
      array, collection.toArray(array));
}
 
Example 35
Project: guava-libraries   File: MapGetTester.java   View source code 5 votes vote down vote up
public void testGet_wrongType() {
  try {
    assertNull("get(wrongType) should return null or throw",
        getMap().get(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
}
 
Example 36
Project: guava-libraries   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@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) {
  }
}
 
Example 37
Project: guava-libraries   File: CollectionToArrayTester.java   View source code 5 votes vote down vote up
@CollectionSize.Require(ZERO)
public void testToArray_emptyArrayOfWrongTypeForEmptyCollection() {
  WrongType[] array = new WrongType[0];
  assertSame(
      "toArray(sameSizeNotAssignableTo[]) should return the given array",
      array, collection.toArray(array));
}
 
Example 38
Project: guava   File: MultisetRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_occurrences_wrongType() {
  assertEquals(
      "multiset.remove(wrongType, 1) didn't return 0",
      0,
      getMultiset().remove(WrongType.VALUE, 1));
}
 
Example 39
Project: guava   File: CollectionContainsAllTester.java   View source code 5 votes vote down vote up
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) {
  }
}
 
Example 40
Project: guava   File: CollectionRemoveTester.java   View source code 5 votes vote down vote up
@CollectionFeature.Require(SUPPORTS_REMOVE)
public void testRemove_wrongType() {
  try {
    assertFalse(collection.remove(WrongType.VALUE));
  } catch (ClassCastException tolerated) {
  }
  expectUnchanged();
}