-
-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) 2003-2013, Jodd Team (jodd.org). All Rights Reserved. | ||
|
||
package jodd.http; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class HttpBrowserTest { | ||
|
||
static TestServer testServer; | ||
|
||
@BeforeClass | ||
public static void startServer() throws Exception { | ||
testServer = new TomcatServer(); | ||
testServer.start(); | ||
} | ||
|
||
@AfterClass | ||
public static void stopServer() throws Exception { | ||
testServer.stop(); | ||
} | ||
|
||
@Before | ||
public void setUp() { | ||
EchoServlet.testinit(); | ||
} | ||
|
||
@Test | ||
public void testBrowser() { | ||
HttpBrowser httpBrowser = new HttpBrowser(); | ||
|
||
httpBrowser.sendRequest( | ||
HttpRequest.get("localhost:8080/echo?id=17").bodyText("hello")); | ||
HttpResponse httpResponse = httpBrowser.getHttpResponse(); | ||
|
||
assertNotNull(httpResponse); | ||
assertEquals("hello", httpResponse.body()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters