Error { public String getDetailMessage() { return detailMessage; } private  Error(final ErrorBuilder builder); int getStatusCode(); @JsonSerialize(using = StatusSerialiser.class) Status getStatus(); String getSimpleMessage(); String getDetailMessage(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void shouldNotBuildDetailedMessage() { setDebugMode("false"); final Error error = new ErrorBuilder() .simpleMessage(SIMPLE_MSG) .detailMessage(DETAILED_MSG) .build(); assertNotEquals(DETAILED_MSG, error.getDetailMessage()); }
@Test public void shouldNotBuildDetailedMessageWithMissingPropertyFlag() { clearDebugModeProperty(); final Error error = new ErrorBuilder() .simpleMessage(SIMPLE_MSG) .detailMessage(DETAILED_MSG) .build(); assertNotEquals(DETAILED_MSG, error.getDetailMessage()); }
@Test public void shouldNotBuildDetailedMessageWithIncorrectPropertyFlag() { setDebugMode("wrong"); final Error error = new ErrorBuilder() .simpleMessage(SIMPLE_MSG) .detailMessage(DETAILED_MSG) .build(); assertNotEquals(DETAILED_MSG, error.getDetailMessage()); }