Skip to content

Commit

Permalink
updating version of routd dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lantunes committed Nov 30, 2018
1 parent 1f71cae commit 2b78e6c
Show file tree
Hide file tree
Showing 3 changed files with 418 additions and 424 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.bigtesting</groupId>
<artifactId>routd</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.bigtesting</groupId>
Expand Down Expand Up @@ -95,7 +95,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.0</version>
<version>2.8.11.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
52 changes: 17 additions & 35 deletions src/test/java/org/bigtesting/fixd/tests/TestCapturedRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@
public class TestCapturedRequest {

private ServerFixture server;

private AsyncHttpClient client;

@Before
public void beforeEachTest() throws Exception {
server = new ServerFixture(8080);
server.start();
client = new AsyncHttpClient();
}

@Test
Expand All @@ -46,10 +49,7 @@ public void testGetPath_Root() throws Exception {
server.handle(Method.GET, "/")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/")
.execute()
.get();
client.prepareGet("http://localhost:8080/").execute().get();

CapturedRequest captured = server.request();
assertEquals("/", captured.getPath());
Expand All @@ -61,10 +61,7 @@ public void testGetPath_SomePath() throws Exception {
server.handle(Method.GET, "/some/path")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/some/path")
.execute()
.get();
client.prepareGet("http://localhost:8080/some/path").execute().get();

CapturedRequest captured = server.request();
assertEquals("/some/path", captured.getPath());
Expand All @@ -75,11 +72,8 @@ public void testGetPath_SomePathWithParam() throws Exception {

server.handle(Method.GET, "/some/path/:param")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/some/path/123")
.execute()
.get();

client.prepareGet("http://localhost:8080/some/path/123").execute().get();

CapturedRequest captured = server.request();
assertEquals("/some/path/123", captured.getPath());
Expand All @@ -91,10 +85,7 @@ public void testGetRequestLine() throws Exception {
server.handle(Method.GET, "/")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/")
.execute()
.get();
client.prepareGet("http://localhost:8080/").execute().get();

CapturedRequest captured = server.request();
assertEquals("GET / HTTP/1.1", captured.getRequestLine());
Expand All @@ -106,10 +97,7 @@ public void testGetMethod() throws Exception {
server.handle(Method.GET, "/")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/")
.execute()
.get();
client.prepareGet("http://localhost:8080/").execute().get();

CapturedRequest captured = server.request();
assertEquals("GET", captured.getMethod());
Expand All @@ -121,10 +109,7 @@ public void testGetHeaders() throws Exception {
server.handle(Method.GET, "/")
.with(200, "text/plain", "Hello");

new AsyncHttpClient()
.prepareGet("http://localhost:8080/")
.execute()
.get();
client.prepareGet("http://localhost:8080/").execute().get();

CapturedRequest captured = server.request();
assertEquals("[Host: localhost:8080, " +
Expand All @@ -141,12 +126,10 @@ public void testGetBody() throws Exception {
.with(200, "text/plain", "Hello");

byte[] body = "Hello".getBytes();

new AsyncHttpClient()
.preparePut("http://localhost:8080/")

client.preparePut("http://localhost:8080/")
.setBody(body)
.execute()
.get();
.execute().get();

CapturedRequest captured = server.request();
assertArrayEquals(body, captured.getBody());
Expand All @@ -159,12 +142,10 @@ public void testGetEncodedBody() throws Exception {
.with(200, "text/plain", "Hello");

String unicodeContainingBody = "A\u00ea\u00f1\u00fC";

new AsyncHttpClient()
.preparePut("http://localhost:8080/")

client.preparePut("http://localhost:8080/")
.setBody(unicodeContainingBody)
.execute()
.get();
.execute().get();

CapturedRequest captured = server.request();
assertEquals(
Expand All @@ -175,5 +156,6 @@ public void testGetEncodedBody() throws Exception {
@After
public void afterEachTest() throws Exception {
server.stop();
client.close();
}
}

0 comments on commit 2b78e6c

Please sign in to comment.