public void testParameterNotInstantiableForEqualsTest() throws Exception { try { tester.doTestEquals(ConstructorParameterNotInstantiable.class); fail("should have failed"); } catch (ParameterNotInstantiableException expected) { } }
public void testFactoryMethodReturnsNullButNotAnnotatedInEqualsTest() throws Exception { try { tester.testEquals(FactoryMethodReturnsNullButNotAnnotated.class); } catch (AssertionFailedError expected) { return; } fail("should have failed"); }
public void testBadNulls() throws Exception { try { tester.testNulls(BadNulls.class); } catch (AssertionFailedError expected) { return; } fail("should have failed"); }
public void testSetDistinctValues_equalInstances() { try { tester.setDistinctValues(String.class, "", ""); fail(); } catch (IllegalArgumentException expected) { } }
public void testInstantiate_constructorThrows() throws Exception { try { tester.instantiate(ConstructorThrows.class); fail(); } catch (InvocationTargetException expected) { } }
public void testInstantiate_factoryMethodParameterNotInstantiable() throws Exception { try { tester.instantiate(FactoryMethodParameterNotInstantiable.class); fail(); } catch (ParameterNotInstantiableException expected) { } }
public void testNoDistinctValueForEqualsTest() throws Exception { try { tester.doTestEquals(ConstructorParameterSingleValue.class); fail("should have failed"); } catch (ParameterHasNoDistinctValueException expected) { } }
public void testConstructorThrowsForEqualsTest() throws Exception { try { tester.doTestEquals(ConstructorThrows.class); fail("should have failed"); } catch (InvocationTargetException expected) { } }
public void testFactoryMethodReturnsNullForEqualsTest() throws Exception { try { tester.doTestEquals(FactoryMethodReturnsNullAndAnnotated.class); fail("should have failed"); } catch (FactoryMethodReturnsNullException expected) { } }
public void testEnumFailsToCheckNull() throws Exception { try { tester.testNulls(EnumFailsToCheckNull.class); } catch (AssertionFailedError expected) { return; } fail("should have failed"); }
public void testInstantiate_factoryMethodReturnsNullAndAnnotated() throws Exception { try { tester.instantiate(FactoryMethodReturnsNullAndAnnotated.class); fail("should have failed"); } catch (FactoryMethodReturnsNullException expected) { } }
public void testEquals_setOfNonInstantiable() throws Exception { try { new ClassSanityTester().doTestEquals(SetWrapper.class); fail(); } catch (ParameterNotInstantiableException expected) { } }
public void testSerializableOnReturnValues_bad() throws Exception { try { tester.forAllPublicStaticMethods(BadSerializableFactory.class).testSerializable(); } catch (AssertionFailedError expected) { return; } fail(); }
public void testEqualsAndSerializableOnReturnValues_equalsIsGoodButNotSerializable() throws Exception { try { tester.forAllPublicStaticMethods(GoodEqualsFactory.class).testEqualsAndSerializable(); } catch (AssertionFailedError expected) { return; } fail("should have failed"); }
public void testSerializableForReturnValues_factoryReturnsNullButNotAnnotated() throws Exception { try { tester .forAllPublicStaticMethods(FactoryThatReturnsNullButNotAnnotated.class) .testSerializable(); } catch (AssertionFailedError expected) { return; } fail(); }
private void assertBadUseOfReferentialEquality(Class<?> cls) throws Exception { try { tester.testEquals(cls); } catch (AssertionFailedError expected) { assertThat(expected.getMessage()).contains(cls.getSimpleName() + "("); return; } fail("should have failed for " + cls); }
public void testBadEquals() throws Exception { try { tester.testEquals(BadEquals.class); } catch (AssertionFailedError expected) { assertThat(expected.getMessage()).contains("create(null)"); return; } fail("should have failed"); }
public void testInstantiate_factoryMethodReturnsNullButNotAnnotated() throws Exception { try { tester.instantiate(FactoryMethodReturnsNullButNotAnnotated.class); } catch (AssertionFailedError expected) { assertThat(expected.getMessage()).contains("@Nullable"); return; } fail("should have failed"); }
public void testBadEquals_withParameterizedType() throws Exception { try { tester.testEquals(BadEqualsWithParameterizedType.class); } catch (AssertionFailedError expected) { assertThat(expected.getMessage()).contains("create([[1]])"); return; } fail("should have failed"); }
public void testNullsOnReturnValues_bad() throws Exception { try { tester.forAllPublicStaticMethods(BadNullsFactory.class).thatReturn(Object.class).testNulls(); } catch (AssertionFailedError expected) { return; } fail(); }