11package httpserver .responder ;
22
33import httpserver .AppConfig ;
4+ import httpserver .Method ;
45import httpserver .Range ;
56import httpserver .file .Html ;
67import httpserver .file .PathExaminer ;
@@ -44,7 +45,7 @@ public GetResponderTest() throws IOException {
4445
4546 @ Test
4647 public void returns404ForBadPath () throws Exception {
47- Request request = new Request (" GET" ,
48+ Request request = new Request (Method . GET ,
4849 "nonexistentfile123" , new Header [0 ], "" );
4950
5051 Response response = getResponder .respond (appConfigMock , request );
@@ -60,7 +61,7 @@ public void ifPathInRouteMapGetsResponderAndCallsRespond() throws Exception {
6061 Responder responderMock = mock (Responder .class );
6162 when (routeMapMock .hasRoute ("/example_route" )).thenReturn (true );
6263 when (routeMapMock .getResponderForRoute ("/example_route" )).thenReturn (responderMock );
63- Request request = new Request (" GET" , "/example_route" , new Header [0 ], "" );
64+ Request request = new Request (Method . GET , "/example_route" , new Header [0 ], "" );
6465
6566 getResponder .respond (appConfigMock , request );
6667
@@ -77,7 +78,7 @@ public void getsFileContentsForPath() throws Exception {
7778 when (pathExaminerMock .isFile (fullPathMock )).thenReturn (true );
7879 byte [] payloadMock = new byte [0 ];
7980 when (pathExaminerMock .fileContents (fullPathMock )).thenReturn (payloadMock );
80- Request request = new Request (" GET" , "/filename" , new Header [0 ], "" );
81+ Request request = new Request (Method . GET , "/filename" , new Header [0 ], "" );
8182
8283 Response response = getResponder .respond (appConfigMock , request );
8384
@@ -107,7 +108,7 @@ public void respondsToRangeRequest() throws Exception {
107108 Range rangeMock = mock (Range .class );
108109 when (rangeHeaderValueParserMock .parse (rangeHeaderValue , payloadMock .length )).thenReturn (rangeMock );
109110
110- Request request = new Request (" GET" , "/filename" , headers , "" );
111+ Request request = new Request (Method . GET , "/filename" , headers , "" );
111112
112113 Response response = getResponder .respond (appConfigMock , request );
113114
@@ -125,7 +126,7 @@ public void getsDirContentsForPath() throws Exception {
125126 Path path2 = mock (Path .class );
126127 Path [] pathArrayMock = new Path []{path1 , path2 };
127128 when (pathExaminerMock .directoryContents (fullPathMock )).thenReturn (pathArrayMock );
128- Request request = new Request (" GET" , "/" , new Header [0 ], "" );
129+ Request request = new Request (Method . GET , "/" , new Header [0 ], "" );
129130
130131 Response response = getResponder .respond (appConfigMock , request );
131132
@@ -144,7 +145,7 @@ public void allowsForm() throws Exception {
144145
145146 @ Test
146147 public void handlesGET () throws Exception {
147- Request getRequest = new Request (" GET" , "" , null , null );
148+ Request getRequest = new Request (Method . GET , "" , null , null );
148149 assertTrue (getResponder .handles (getRequest ));
149150 }
150151}
0 commit comments