### Question:
SpecValidationException extends RuntimeException { @Override public String getMessage() { int errorCount = 0; if (errors != null) errorCount = errors.size(); int warningCount = 0; if (warnings != null) warningCount = warnings.size(); StringBuilder sb = new StringBuilder(); sb.append(System.lineSeparator()) .append("Errors: ") .append(System.lineSeparator()); Optional.ofNullable(errors).ifPresent(_errors -> { for (String msg : errors) { sb.append("\t-").append(msg).append(System.lineSeparator()); } }); Optional.ofNullable(warnings).filter(warnings -> !warnings.isEmpty()).ifPresent(_errors -> { sb.append("Warnings: ").append(System.lineSeparator()); for (String msg : errors) { sb.append("\t-").append(msg).append(System.lineSeparator()); } }); return super.getMessage() + " | " + "Error count: " + errorCount + ", Warning count: " + warningCount + sb.toString(); } SpecValidationException();  SpecValidationException(String message);  SpecValidationException(String message, Throwable cause);  SpecValidationException(Throwable cause);  SpecValidationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace); Set<String> getErrors(); Set<String> getWarnings(); void setErrors(Set<String> errors); void setWarnings(Set<String> warnings); @Override String getMessage();  }### Answer:
@Test public void shouldGetDefaultMessage() { SpecValidationException specValidationException = new SpecValidationException(); String expectedResult = new StringBuffer("null | Error count: 0, Warning count: 0") .append(System.lineSeparator()).append("Errors: ") .append(System.lineSeparator()).toString(); Assert.assertEquals(specValidationException.getMessage(), expectedResult); }