private boolean isInstanceOfClass(Object actual, Class<?> clazz, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(clazz); return clazz.isInstance(actual); }
private boolean actualIsExactlyInstanceOfType(Object actual, Class<?> expectedType, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(expectedType); return expectedType.equals(actual.getClass()); }
private boolean isInstanceOfClass(Object actual, Class<?> clazz, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(clazz); return clazz.isInstance(actual); }
private boolean actualIsExactlyInstanceOfType(Object actual, Class<?> expectedType, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(expectedType); return expectedType.equals(actual.getClass()); }
/** * Assert that the cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the given * type. */ public void assertHasCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable cause = actual.getCause(); if (cause != null && type.equals(cause.getClass())) return; throw failures.failure(info, shouldHaveCauseExactlyInstance(actual, type)); }
/** * Assert that the cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(actual.getCause())) return; throw failures.failure(info, shouldHaveCauseInstance(actual, type)); }
/** * Assert that the cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the given * type. */ public void assertHasCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable cause = actual.getCause(); if (cause != null && type.equals(cause.getClass())) return; throw failures.failure(info, shouldHaveCauseExactlyInstance(actual, type)); }
/** * Assert that the cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(actual.getCause())) return; throw failures.failure(info, shouldHaveCauseInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the root cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the * given type. */ public void assertHasRootCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable rootCause = getRootCause(actual); if (rootCause != null && type.equals(rootCause.getClass())) return; throw failures.failure(info, shouldHaveRootCauseExactlyInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasRootCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(getRootCause(actual))) return; throw failures.failure(info, shouldHaveRootCauseInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the root cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the * given type. */ public void assertHasRootCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable rootCause = getRootCause(actual); if (rootCause != null && type.equals(rootCause.getClass())) return; throw failures.failure(info, shouldHaveRootCauseExactlyInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasRootCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(getRootCause(actual))) return; throw failures.failure(info, shouldHaveRootCauseInstance(actual, type)); }
private boolean actualIsExactlyInstanceOfType(Object actual, Class<?> expectedType, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(expectedType); return expectedType.equals(actual.getClass()); }
private boolean isInstanceOfClass(Object actual, Class<?> clazz, AssertionInfo info) { assertNotNull(info, actual); checkTypeIsNotNull(clazz); return clazz.isInstance(actual); }
/** * Assert that the cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(actual.getCause())) return; throw failures.failure(info, shouldHaveCauseInstance(actual, type)); }
/** * Assert that the cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the given * type. */ public void assertHasCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable cause = actual.getCause(); if (cause != null && type.equals(cause.getClass())) return; throw failures.failure(info, shouldHaveCauseExactlyInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is <b>exactly</b> an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the root cause of the actual {@code Throwable} is not <b>exactly</b> an instance of the * given type. */ public void assertHasRootCauseExactlyInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); Throwable rootCause = getRootCause(actual); if (rootCause != null && type.equals(rootCause.getClass())) return; throw failures.failure(info, shouldHaveRootCauseExactlyInstance(actual, type)); }
/** * Assert that the root cause of actual {@code Throwable} is an instance of the given type. * * @param info contains information about the assertion. * @param actual the given {@code Throwable}. * @param type the expected cause type. * @throws NullPointerException if given type is {@code null}. * @throws AssertionError if the actual {@code Throwable} is {@code null}. * @throws AssertionError if the actual {@code Throwable} has no cause. * @throws AssertionError if the cause of the actual {@code Throwable} is not an instance of the given type. */ public void assertHasRootCauseInstanceOf(AssertionInfo info, Throwable actual, Class<? extends Throwable> type) { assertNotNull(info, actual); checkTypeIsNotNull(type); if (type.isInstance(getRootCause(actual))) return; throw failures.failure(info, shouldHaveRootCauseInstance(actual, type)); }