Skip to content

Commit

Permalink
#109 assertHeaders() tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Yegor Bugayenko committed Sep 4, 2015
1 parent 11694d3 commit 3b99dad
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/test/java/com/jcabi/http/response/RestResponseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/
package com.jcabi.http.response;

import com.jcabi.http.Response;
import com.jcabi.http.request.FakeRequest;
import java.net.HttpURLConnection;
import java.net.URI;
Expand All @@ -55,6 +56,19 @@ public void assertsHttpStatusCode() throws Exception {
).assertStatus(HttpURLConnection.HTTP_NOT_FOUND);
}

/**
* RestResponse can assert HTTP header.
* @throws Exception If something goes wrong inside
*/
@Test(expected = AssertionError.class)
public void assertsHttpHeaders() throws Exception {
final String value = "t66";
final Response rsp = new FakeRequest().withHeader("Abc", value).fetch();
new RestResponse(rsp).assertHeader(
"abc", Matchers.hasItems(value)
);
}

/**
* RestResponse can retrieve a cookie by name.
* @throws Exception If something goes wrong inside
Expand Down

0 comments on commit 3b99dad

Please sign in to comment.