File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
main/java/httpserver/response
test/java/httpserver/response Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ package httpserver .response ;
2+
3+ import httpserver .header .Header ;
4+
5+ public class FoundResponse extends Response {
6+ public FoundResponse (String location ) {
7+ super .setHeader (new Header ("Location" , location ));
8+ }
9+
10+ @ Override
11+ public int getStatusCode () {
12+ return 302 ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package httpserver .response ;
2+
3+ import httpserver .header .Header ;
4+ import org .junit .Test ;
5+
6+ import static org .junit .Assert .*;
7+
8+ public class FoundResponseTest {
9+ @ Test
10+ public void hasStatusCode302 () throws Exception {
11+ FoundResponse foundResponse = new FoundResponse ("example" );
12+
13+ Header [] expected = new Header []{new Header ("Location" , "example" )};
14+ assertEquals (302 , foundResponse .getStatusCode ());
15+ assertEquals (expected , foundResponse .getHeaders ());
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments