@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractObjectAssert) { AbstractObjectAssert objectAssert = (AbstractObjectAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withTypeComparator(objectAssert.comparatorByType) .withComparatorByPropertyOrField(objectAssert.comparatorByPropertyOrField); } return super.withAssertionState(assertInstance); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractObjectAssert) { AbstractObjectAssert objectAssert = (AbstractObjectAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withTypeComparator(objectAssert.comparatorByType) .withComparatorByPropertyOrField(objectAssert.comparatorByPropertyOrField); } return super.withAssertionState(assertInstance); }
@RuntimeType public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception { try { Object result = proxy.call(); if (result != assertion && result instanceof AbstractAssert) { return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion); } return result; } catch (AssertionError e) { throw assumptionNotMet(e); } } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractObjectArrayAssert) { AbstractObjectArrayAssert objectArrayAssert = (AbstractObjectArrayAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(objectArrayAssert.iterables) .withObjectArrays(objectArrayAssert.arrays) .withTypeComparators(objectArrayAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(objectArrayAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(objectArrayAssert.comparatorsForElementPropertyOrFieldTypes); } return super.withAssertionState(assertInstance); }
@RuntimeType public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception { try { Object result = proxy.call(); if (result != assertion && result instanceof AbstractAssert) { return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion); } return result; } catch (AssertionError e) { throw assumptionNotMet(e); } } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractObjectArrayAssert) { AbstractObjectArrayAssert objectArrayAssert = (AbstractObjectArrayAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(objectArrayAssert.iterables) .withObjectArrays(objectArrayAssert.arrays) .withTypeComparators(objectArrayAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(objectArrayAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(objectArrayAssert.comparatorsForElementPropertyOrFieldTypes); } return super.withAssertionState(assertInstance); }
@RuntimeType public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher, @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod, @This AbstractAssert<?, ?> currentAssertInstance) throws Exception { Object result = assertionMethod.call(); return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractIterableAssert) { AbstractIterableAssert iterableAssert = (AbstractIterableAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(iterableAssert.iterables) .withTypeComparators(iterableAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(iterableAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(iterableAssert.comparatorsForElementPropertyOrFieldTypes); } // we can go from ObjectArrayAssert -> IterableAssert when using extracting on an object array if (assertInstance instanceof AbstractObjectArrayAssert) { AbstractObjectArrayAssert objectArrayAssert = (AbstractObjectArrayAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(objectArrayAssert.iterables) .withTypeComparators(objectArrayAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(objectArrayAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(objectArrayAssert.comparatorsForElementPropertyOrFieldTypes); } return super.withAssertionState(assertInstance); }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override SELF withAssertionState(AbstractAssert assertInstance) { if (assertInstance instanceof AbstractIterableAssert) { AbstractIterableAssert iterableAssert = (AbstractIterableAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(iterableAssert.iterables) .withTypeComparators(iterableAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(iterableAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(iterableAssert.comparatorsForElementPropertyOrFieldTypes); } // we can go from ObjectArrayAssert -> IterableAssert when using extracting on an object array if (assertInstance instanceof AbstractObjectArrayAssert) { AbstractObjectArrayAssert objectArrayAssert = (AbstractObjectArrayAssert) assertInstance; return (SELF) super.withAssertionState(assertInstance).withIterables(objectArrayAssert.iterables) .withTypeComparators(objectArrayAssert.comparatorsByType) .withComparatorsForElementPropertyOrFieldNames(objectArrayAssert.comparatorsForElementPropertyOrFieldNames) .withComparatorsForElementPropertyOrFieldTypes(objectArrayAssert.comparatorsForElementPropertyOrFieldTypes); } return super.withAssertionState(assertInstance); }
@RuntimeType public static AbstractAssert<?, ?> intercept(@FieldValue(FIELD_NAME) ProxifyMethodChangingTheObjectUnderTest dispatcher, @SuperCall Callable<AbstractAssert<?, ?>> assertionMethod, @This AbstractAssert<?, ?> currentAssertInstance) throws Exception { Object result = assertionMethod.call(); return dispatcher.createAssertProxy(result).withAssertionState(currentAssertInstance); }