/** Test method for {@link FailureReport#cause()}. */ @Test public void cause() { final ThrowingMethod method = () -> { final FailureReport<String> failReport = new FailureReport<>(); failReport.cause(null); }; assertThat(method, throwsException(NullPointerException.class)); final FailureReport<String> failReport1 = new FailureReport<>(); failReport1.cause(new IllegalArgumentException("illegal arg")); assertThat(failReport1.getFailureMessage(), containsString("illegal arg")); final FailureReport<String> failReport2 = new FailureReport<>(); failReport2.message("failure message"); failReport2.cause(new IllegalArgumentException("illegal arg")); assertThat(failReport2.getFailureMessage(), containsString("failure message")); }
/** Test method for {@link FailureReport#message()}. */ @Test public void message() { final String message = "failureMessage"; final FailureReport<String> failReport = new FailureReport<>(); failReport.message("failureMessage"); assertThat(failReport.getFailureMessage(), containsString(message)); final ThrowingMethod method = () -> { final FailureReport<String> failReport1 = new FailureReport<>(); failReport1.message(null); }; assertThat(method, throwsException(NullPointerException.class)); }
/** Test method for {@link FailureReport#getMessage(String, Object...)}. */ @Test public void getMessage() { final FailureReport<String> failReport = new FailureReport<>(); assertThat(failReport.getFailureMessage(), is(this.failureMessage)); }