public void testEqualsAndSerializableForReturnValues_factoryReturnsNullAndAnnotated() throws Exception { tester .forAllPublicStaticMethods(FactoryThatReturnsNullAndAnnotated.class) .testEqualsAndSerializable(); }
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(); }
public void testEqualsOnReturnValues_bad() throws Exception { try { tester.forAllPublicStaticMethods(BadEqualsFactory.class).testEquals(); } catch (AssertionFailedError expected) { return; } fail(); }
public void testEqualsAndSerializableOnReturnValues_serializableButNotEquals() throws Exception { try { tester.forAllPublicStaticMethods(GoodSerializableFactory.class).testEqualsAndSerializable(); } catch (AssertionFailedError expected) { return; } fail("should have failed"); }
public void testEqualsForReturnValues_factoryReturnsNullButNotAnnotated() throws Exception { try { tester.forAllPublicStaticMethods(FactoryThatReturnsNullButNotAnnotated.class).testEquals(); } catch (AssertionFailedError expected) { return; } fail(); }
public void testNullsForReturnValues_factoryReturnsNullButNotAnnotated() throws Exception { try { tester.forAllPublicStaticMethods(FactoryThatReturnsNullButNotAnnotated.class).testNulls(); } catch (AssertionFailedError expected) { return; } fail(); }
public void testEqualsAndSerializableForReturnValues_factoryReturnsNullButNotAnnotated() throws Exception { try { tester .forAllPublicStaticMethods(FactoryThatReturnsNullButNotAnnotated.class) .testEqualsAndSerializable(); } catch (AssertionFailedError expected) { return; } fail(); }
@AndroidIncompatible // TODO(cpovirk): ClassNotFoundException... ClassSanityTesterTest$AnInterface public void testSerializableOnReturnValues_good() throws Exception { tester.forAllPublicStaticMethods(GoodSerializableFactory.class).testSerializable(); }
@AndroidIncompatible // TODO(cpovirk): ClassNotFoundException... ClassSanityTesterTest$AnInterface public void testEqualsAndSerializableOnReturnValues_good() throws Exception { tester .forAllPublicStaticMethods(GoodEqualsAndSerialiableFactory.class) .testEqualsAndSerializable(); }
public void testAdapters_nullChecks() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(JdkFutureAdapters.class) .thatReturn(Future.class) .testNulls(); } }
public void testNullsOnReturnValues_bad() throws Exception { try { tester.forAllPublicStaticMethods(BadNullsFactory.class).thatReturn(Object.class).testNulls(); } catch (AssertionFailedError expected) { return; } fail(); }
@GwtIncompatible // reflection @AndroidIncompatible // TODO(cpovirk): ClassNotFoundException: com.google.common.base.Function // (I suspect that this and the other similar failures happen with ArbitraryInstances proxies.) public void testEqualsAndSerializable() throws Exception { new ClassSanityTester().forAllPublicStaticMethods(Functions.class).testEqualsAndSerializable(); }
@GwtIncompatible // reflection @AndroidIncompatible // TODO(cpovirk): ClassNotFoundException: com.google.common.base.Function public void testSuppliersSerializable() throws Exception { new ClassSanityTester().forAllPublicStaticMethods(Suppliers.class).testSerializable(); }
@GwtIncompatible // reflection public void testIterables_nullCheck() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Iterables.class) .thatReturn(Iterable.class) .testNulls(); }
@GwtIncompatible // ClassSanityTester public void testFutures_nullChecks() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Futures.class) .thatReturn(Future.class) .testNulls(); }
@GwtIncompatible // reflection @AndroidIncompatible // TODO(cpovirk): ClassNotFoundException: com.google.common.base.Function public void testEqualsAndSerializable() throws Exception { new ClassSanityTester().forAllPublicStaticMethods(Predicates.class).testEqualsAndSerializable(); }
private static ClassSanityTester.FactoryMethodReturnValueTester sanityTester() { return new ClassSanityTester() .setDefault(byte[].class, new byte[] {1, 2, 3, 4}) .setDistinctValues(byte[].class, new byte[] {1, 2, 3, 4}, new byte[] {5, 6, 7, 8}) .setDistinctValues(String.class, "7f8005ff0e", "7f8005ff0f") .forAllPublicStaticMethods(HashCode.class); }
@GwtIncompatible // reflection public void testEquals() throws Exception { new ClassSanityTester() .setDistinctValues(Class.class, Color.class, Gender.class) .setDistinctValues(Enum.class, Color.BLUE, Color.RED) .forAllPublicStaticMethods(EnumMultisetFactory.class) .testEquals(); }