@@ -22,7 +22,6 @@ public class SocketHandlerTest {
2222 private final Path root ;
2323 private final Path relativePath1 ;
2424 private final Path relativePath2 ;
25- private final Logger logger ;
2625 private final AppConfig appConfig ;
2726 private final AppConfig appConfigMock ;
2827 private final InputStream inputStreamMock ;
@@ -35,8 +34,8 @@ public class SocketHandlerTest {
3534
3635 public SocketHandlerTest () throws IOException {
3736 root = tempDir ();
38- logger = new Logger ( root . resolve ( "logs" ), new FileOperator (), System . err );
39- appConfig = new AppConfig (root , logger );
37+ loggerMock = mock ( Logger . class );
38+ appConfig = new AppConfig (root , loggerMock );
4039 relativePath1 = root .relativize (tempFileOptions (root , "aaa" , "temp" ));
4140 relativePath2 = root .relativize (tempFileOptions (root , "bbb" , "temp" ));
4241 appConfigMock = mock (AppConfig .class );
@@ -46,7 +45,6 @@ public SocketHandlerTest() throws IOException {
4645 responderMock = mock (Responder .class );
4746 responseMock = mock (Response .class );
4847 responseWriterMock = mock (ResponseWriter .class );
49- loggerMock = mock (Logger .class );
5048 }
5149
5250 @ Test
@@ -117,13 +115,13 @@ public void writesContentTypeForGif() throws Exception {
117115 @ Test
118116 public void writesRequestedDirContentsAsHtmlToOutputStreamForGET () throws Exception {
119117 String expectedBody = "<div><a href=\" /" + relativePath1 + "\" >/" + relativePath1 + "</a></div>" +
120- "<div><a href=\" /" + relativePath2 + "\" >/" + relativePath2 + "</a></div>" +
121- "<div><a href=\" /logs\" >/logs</a></div>" ;
118+ "<div><a href=\" /" + relativePath2 + "\" >/" + relativePath2 + "</a></div>" ;
122119
123120 byte [] request = ("GET / HTTP/1.1\r \n Host: 127.0.0.1:5000\r \n \r \n " ).getBytes ();
124121
125122 String expected = "HTTP/1.1 200 OK\r \n Content-Length: " + expectedBody .length () + "\r \n \r \n " + expectedBody ;
126- assertEquals (expected , stringOutputForRequestBytes (request ));
123+ String actual = stringOutputForRequestBytes (request );
124+ assertTrue (actual .contains (expected ));
127125 }
128126
129127 @ Test
0 commit comments