private void assertNotNull(AssertionInfo info, CharSequence actual) { Objects.instance().assertNotNull(info, actual); }
/** {@inheritDoc} */ @Override public SELF isEqualTo(Object expected) { objects.assertEqual(info, actual, expected); return myself; }
/** {@inheritDoc} */ @Override public void isNull() { objects.assertNull(info, actual); }
@Override protected boolean areEqual(Object actualElement, Object otherElement) { try { return Objects.instance().areEqualToComparingOnlyGivenFields(actualElement, otherElement, comparatorsByPropertyOrField, comparatorsByType, fields); } catch (IntrospectionError e) { return false; } }
protected boolean areEqual(Object actual, Object other) { try { return Objects.instance().areEqualToIgnoringGivenFields(actual, other, comparatorsByPropertyOrField, comparatorsByType); } catch (IntrospectionError e) { return false; } }
/** {@inheritDoc} */ @Override public SELF isNotNull() { objects.assertNotNull(info, actual); return myself; }
/** * Verifies that the actual value is an array, and returns an array assertion, to * allow chaining of array-specific assertions from this call. * @return an array assertion object */ public AbstractObjectArrayAssert<?, Object> asArray() { Objects.instance().assertIsInstanceOf(this.info, this.actual, Object[].class); return Assertions.assertThat((Object[]) this.actual); }
private boolean isOfOneOfGivenTypes(Object actual, Class<?>[] types, AssertionInfo info) { assertNotNull(info, actual); checkNotNull(types, "The given types should not be null"); return isItemInArray(actual.getClass(), types); }
private boolean objectIsInstanceOfOneOfGivenClasses(Object actual, Class<?>[] types, AssertionInfo info) { checkIsNotNullAndIsNotEmpty(types); assertNotNull(info, actual); for (Class<?> type : types) { String format = "The given array of types:<%s> should not have null elements"; checkNotNull(type, format(format, info.representation().toStringOf(types))); if (type.isInstance(actual)) { return true; } } return false; }
public <A> void assertHasFieldOrProperty(AssertionInfo info, A actual, String name) { assertNotNull(info, actual); try { extractPropertyOrField(actual, name); } catch (IntrospectionError error) { throw failures.failure(info, shouldHavePropertyOrField(actual, name)); } }
/** {@inheritDoc} */ @Override @CheckReturnValue public SELF usingDefaultComparator() { // fall back to default strategy to compare actual with other objects. this.objects = Objects.instance(); return myself; }
/** {@inheritDoc} */ @Override public SELF isInstanceOf(Class<?> type) { objects.assertIsInstanceOf(info, actual, type); return myself; }
/** {@inheritDoc} */ @Override @CheckReturnValue public SELF usingComparator(Comparator<? super ACTUAL> customComparator, String customComparatorDescription) { // using a specific strategy to compare actual with other objects. this.objects = new Objects(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription)); return myself; }
/** {@inheritDoc} */ @Override public SELF isNotNull() { objects.assertNotNull(info, actual); return myself; }
@Override protected boolean areEqual(Object actualElement, Object otherElement) { try { return Objects.instance().areEqualToIgnoringGivenFields(actualElement, otherElement, comparatorsByPropertyOrField, comparatorsByType, fields); } catch (IntrospectionError e) { return false; } }
/** * Verifies that the actual value is a map, and returns a map assertion, to allow * chaining of map-specific assertions from this call. * @return a map assertion object */ @SuppressWarnings("unchecked") public AbstractMapAssert<?, ?, Object, Object> asMap() { Objects.instance().assertIsInstanceOf(this.info, this.actual, Map.class); return Assertions.assertThat((Map<Object, Object>) this.actual); }
@Override protected boolean areEqual(Object actualElement, Object otherElement) { try { return Objects.instance().areEqualToComparingOnlyGivenFields(actualElement, otherElement, comparatorsByPropertyOrField, comparatorsByType, fields); } catch (IntrospectionError e) { return false; } }
/** {@inheritDoc} */ @Override public SELF isInstanceOf(Class<?> type) { objects.assertIsInstanceOf(info, actual, type); return myself; }
/** {@inheritDoc} */ @Override @CheckReturnValue public SELF usingComparator(Comparator<? super ACTUAL> customComparator, String customComparatorDescription) { // using a specific strategy to compare actual with other objects. this.objects = new Objects(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription)); return myself; }
private static void assertNotNull(AssertionInfo info, Class<?> actual) { Objects.instance().assertNotNull(info, actual); }