Error implements Field { @Override public String formattedValue() { return FIELD_NAME + ": " + text.formatted(); } Error(Text text); Text getText(); @Override String formattedValue(); @Override final boolean equals(Object o); @Override final int hashCode(); @Override String toString(); static final String FIELD_NAME; }
@Test void formattedValueShouldDisplayMessage() { assertThat(new Error(Text.fromRawText("Message")) .formattedValue()) .isEqualTo("Error: Message"); }
@Test void formattedValueShouldDisplayMultiLineMessage() { assertThat(new Error(Text.fromRawText("Multi\nline\nMessage")) .formattedValue()) .isEqualTo("Error: Multi\r\n line\r\n Message"); }