@Test public void responseWithoutDescriptionsCanBeRoundTripped() { // Act: final ErrorResponse response = createRoundTrippedResponse(new ErrorResponse(new TimeInstant(54), null, 890)); // Assert: Assert.assertThat(response.getTimeStamp(), IsEqual.equalTo(new TimeInstant(54))); Assert.assertThat(response.getError(), IsNull.nullValue()); Assert.assertThat(response.getMessage(), IsNull.nullValue()); Assert.assertThat(response.getStatus(), IsEqual.equalTo(890)); }
@Test public void canBeCreatedAroundUnknownHttpStatus() { // Arrange: final ErrorResponse response = new ErrorResponse(new TimeInstant(18), "exception message", -123); // Assert: Assert.assertThat(response.getTimeStamp(), IsEqual.equalTo(new TimeInstant(18))); Assert.assertThat(response.getError(), IsNull.nullValue()); Assert.assertThat(response.getMessage(), IsEqual.equalTo("exception message")); Assert.assertThat(response.getStatus(), IsEqual.equalTo(-123)); }