public void assertEqualHashCode( Predicate<? super Integer> expected, Predicate<? super Integer> actual) { assertEquals(actual + " should hash like " + expected, expected.hashCode(), actual.hashCode()); }
@GwtIncompatible // SerializableTester public void testIsNull_serialization() { Predicate<String> pre = Predicates.isNull(); Predicate<String> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply("foo"), post.apply("foo")); assertEquals(pre.apply(null), post.apply(null)); }
private static <T> void assertEvalsLike( Predicate<? super T> expected, Predicate<? super T> actual, T input) { Boolean expectedResult = null; RuntimeException expectedRuntimeException = null; try { expectedResult = expected.apply(input); } catch (RuntimeException e) { expectedRuntimeException = e; } Boolean actualResult = null; RuntimeException actualRuntimeException = null; try { actualResult = actual.apply(input); } catch (RuntimeException e) { actualRuntimeException = e; } assertEquals(expectedResult, actualResult); if (expectedRuntimeException != null) { assertNotNull(actualRuntimeException); assertEquals(expectedRuntimeException.getClass(), actualRuntimeException.getClass()); } }
@GwtIncompatible // SerializableTester @SuppressWarnings("unchecked") // varargs public void testOr_serializationIterable() { Predicate<Integer> pre = Predicates.or(Arrays.asList(TRUE, FALSE)); Predicate<Integer> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply(0), post.apply(0)); }
@GwtIncompatible // SerializableTester public void testContainsPattern_serialization() { Predicate<CharSequence> pre = Predicates.containsPattern("foo"); Predicate<CharSequence> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply("foo"), post.apply("foo")); }
public void assertEqualHashCode( Predicate<? super Integer> expected, Predicate<? super Integer> actual) { assertEquals(actual + " should hash like " + expected, expected.hashCode(), actual.hashCode()); }
@GwtIncompatible // SerializableTester public void testIsNull_serialization() { Predicate<String> pre = Predicates.isNull(); Predicate<String> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply("foo"), post.apply("foo")); assertEquals(pre.apply(null), post.apply(null)); }
private static <T> void assertEvalsLike( Predicate<? super T> expected, Predicate<? super T> actual, T input) { Boolean expectedResult = null; RuntimeException expectedRuntimeException = null; try { expectedResult = expected.apply(input); } catch (RuntimeException e) { expectedRuntimeException = e; } Boolean actualResult = null; RuntimeException actualRuntimeException = null; try { actualResult = actual.apply(input); } catch (RuntimeException e) { actualRuntimeException = e; } assertEquals(expectedResult, actualResult); if (expectedRuntimeException != null) { assertNotNull(actualRuntimeException); assertEquals( expectedRuntimeException.getClass(), actualRuntimeException.getClass()); } }
@GwtIncompatible // SerializableTester @SuppressWarnings("unchecked") // varargs public void testOr_serializationIterable() { Predicate<Integer> pre = Predicates.or(Arrays.asList(TRUE, FALSE)); Predicate<Integer> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply(0), post.apply(0)); }
@GwtIncompatible // SerializableTester public void testContainsPattern_serialization() { Predicate<CharSequence> pre = Predicates.containsPattern("foo"); Predicate<CharSequence> post = SerializableTester.reserializeAndAssert(pre); assertEquals(pre.apply("foo"), post.apply("foo")); }