@Test public void the_short_error_message_should_remove_double_quotes() throws IOException { TestStep step = new TestStep("a narrative description"); step.setResult(TestResult.FAILURE); Throwable e = new IllegalStateException("Original error"); step.failedWith(new Exception("Oh nose", e)); assertThat(step.getShortErrorMessage(), is("Original error")); }
@Test public void the_short_error_message_should_only_include_the_first_line() throws IOException { TestStep step = new TestStep("a narrative description"); step.setResult(TestResult.FAILURE); Throwable e = new IllegalStateException("Original error\nwith lots of messy details"); step.failedWith(new Exception("Oh nose", e)); assertThat(step.getShortErrorMessage(), is("Original error")); }
@Test public void the_short_error_message_should_replace_double_quotes_with_single_quotes() throws IOException { TestStep step = new TestStep("a narrative description"); step.setResult(TestResult.FAILURE); Throwable e = new IllegalStateException("Original \"error\"\nwith lots of messy details"); step.failedWith(new Exception("Oh nose", e)); assertThat(step.getShortErrorMessage(), is("Original 'error'")); }