ErrorMessage { public String getType() { return type; } ErrorMessage(Exception exception);  ErrorMessage(String type, String message); String getType(); String getMessage(); void addInfos(Map<String, Object> infos); void addInfo(String key, Object value); Map<String, Object> getInfos();  }
@Test public void should_set_exception_type_as_type() throws Exception { Exception illegalArgumentException = new IllegalArgumentException("an error message"); ErrorMessage errorMessage = new ErrorMessage(illegalArgumentException); assertThat(errorMessage.getType()).isEqualTo("IllegalArgumentException"); }