/** * Assembles a failure message and passes such to the FailureStrategy * * @param verb the check being asserted * @param other the value against which the subject is compared */ protected final void fail(String verb, Object other) { fail(verb, new Object[] {other}); }
public void isA(Class<?> clazz) { if (clazz == null) { throw new NullPointerException("clazz"); } if (!Platform.isInstanceOfType(getSubject(), clazz)) { if (getSubject() != null) { failWithBadResults("is an instance of", clazz.getName(), "is an instance of", getSubject().getClass().getName()); } else { fail("is an instance of", clazz.getName()); } } }
/** * Reports a failure constructing a message from a simple verb. * * @param check the check being asserted */ protected final void fail(String check) { fail(check, new Object[0]); }
@Override public void withValue(Object value) { Subject.this.fail("Cannot test the presence of a value in a non-present field."); } };
@Override public void withValue(Object value) { Subject.this.fail("Cannot test the presence of a value in a null object."); } };