7
7
8
8
import java .io .File ;
9
9
import java .io .IOException ;
10
+ import java .io .OutputStreamWriter ;
10
11
11
12
import static org .junit .Assert .assertEquals ;
13
+ import static org .junit .Assert .assertThat ;
12
14
import static org .junit .Assert .fail ;
15
+ import static org .hamcrest .CoreMatchers .*;
13
16
14
17
public class FormatterFactoryTest {
15
18
private FormatterFactory fc = new FormatterFactory ();
@@ -69,7 +72,7 @@ public void instantiates_usage_formatter_with_file_arg() throws IOException {
69
72
@ Test
70
73
public void instantiates_single_custom_appendable_formatter_with_stdout () {
71
74
WantsAppendable formatter = (WantsAppendable ) fc .create ("cucumber.runtime.formatter.FormatterFactoryTest$WantsAppendable" );
72
- assertEquals ( System .out , formatter . out );
75
+ assertThat ( formatter .out , is ( instanceOf ( OutputStreamWriter . class )) );
73
76
try {
74
77
fc .create ("cucumber.runtime.formatter.FormatterFactoryTest$WantsAppendable" );
75
78
fail ();
@@ -81,7 +84,7 @@ public void instantiates_single_custom_appendable_formatter_with_stdout() {
81
84
@ Test
82
85
public void instantiates_custom_appendable_formatter_with_stdout_and_file () throws IOException {
83
86
WantsAppendable formatter = (WantsAppendable ) fc .create ("cucumber.runtime.formatter.FormatterFactoryTest$WantsAppendable" );
84
- assertEquals ( System .out , formatter . out );
87
+ assertThat ( formatter .out , is ( instanceOf ( OutputStreamWriter . class )) );
85
88
86
89
WantsAppendable formatter2 = (WantsAppendable ) fc .create ("cucumber.runtime.formatter.FormatterFactoryTest$WantsAppendable:" + TempDir .createTempFile ().getAbsolutePath ());
87
90
assertEquals (UTF8FileWriter .class , formatter2 .out .getClass ());
0 commit comments