Ejemplo n.º 1
0
  @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));
  }
Ejemplo n.º 2
0
  @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));
  }