public void testNullsOnReturnValues_returnTypeFiltered() throws Exception { try { tester .forAllPublicStaticMethods(BadNullsFactory.class) .thatReturn(Iterable.class) .testNulls(); } catch (AssertionFailedError expected) { assertThat(expected) .hasMessageThat() .isEqualTo( "No public static methods that return java.lang.Iterable or subtype are found in " + BadNullsFactory.class + "."); return; } fail(); }
public void testNullsOnReturnValues_returnTypeFiltered() throws Exception { try { tester .forAllPublicStaticMethods(BadNullsFactory.class) .thatReturn(Iterable.class) .testNulls(); } catch (AssertionFailedError expected) { assertThat(expected) .hasMessage( "No public static methods that return java.lang.Iterable or subtype are found in " + BadNullsFactory.class + "."); return; } fail(); }
public void testNullsOnReturnValues_returnTypeFiltered() throws Exception { try { tester .forAllPublicStaticMethods(BadNullsFactory.class) .thatReturn(Iterable.class) .testNulls(); } catch (AssertionFailedError expected) { assertEquals( "No public static methods that return java.lang.Iterable or subtype are found in " + BadNullsFactory.class + ".", expected.getMessage()); return; } fail(); }
public void testNullsOnReturnValues_bad() throws Exception { try { tester .forAllPublicStaticMethods(BadNullsFactory.class) .thatReturn(Object.class) .testNulls(); } catch (AssertionFailedError expected) { return; } fail(); }
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(); }
public void testExecutors_nullCheck() throws Exception { new ClassSanityTester() .setDefault(RateLimiter.class, RateLimiter.create(1.0)) .forAllPublicStaticMethods(MoreExecutors.class) .thatReturn(Executor.class) .testNulls(); }
@GwtIncompatible // ClassSanityTester public void testFutures_nullChecks() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Futures.class) .thatReturn(Future.class) .testNulls(); }
@GwtIncompatible // reflection public void testIterables_nullCheck() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Iterables.class) .thatReturn(Iterable.class) .testNulls(); }
public void testExecutors_nullCheck() throws Exception { new ClassSanityTester() .setDefault(RateLimiter.class, RateLimiter.create(1.0)) .forAllPublicStaticMethods(MoreExecutors.class) .thatReturn(Executor.class) .testNulls(); }
public void testNullsOnReturnValues_bad() throws Exception { try { tester.forAllPublicStaticMethods(BadNullsFactory.class).thatReturn(Object.class).testNulls(); } catch (AssertionFailedError expected) { return; } fail(); }
public void testAdapters_nullChecks() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(JdkFutureAdapters.class) .thatReturn(Future.class) .testNulls(); } }
@GwtIncompatible // ClassSanityTester public void testFutures_nullChecks() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Futures.class) .thatReturn(Future.class) .testNulls(); }
@GwtIncompatible // reflection public void testIterables_nullCheck() throws Exception { new ClassSanityTester() .forAllPublicStaticMethods(Iterables.class) .thatReturn(Iterable.class) .testNulls(); }