Skip to content

Commit

Permalink
added test for dumping message without content
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhead committed Oct 29, 2018
1 parent d60c40a commit a524c03
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ public void should_parse_complete_form_urlencoded_media_type() {
}

@Test
@SuppressWarnings("unchecked")
public void should_not_parse_content_when_content_length_not_set() {
public void should_parse_content_when_content_length_not_set() {
assertThat(asContent(messageWithHeaders(ImmutableMap.of(HttpHeaders.CONTENT_TYPE, "text/plain"))), is(EXPECTED_MESSAGE_BODY));
}

@Test
public void should_not_parse_content_when_content_length_not_set() {
assertThat(asContent(DefaultHttpResponse.builder()
.withHeaders(ImmutableMap.of(HttpHeaders.CONTENT_TYPE, "text/plain"))
.withContent("")
.build()), is(""));
}

private void assertMessageContent(final String mediaType, final String expectedContent) {
assertThat(asContent(messageWithHeaders(defaultHeadersFor(mediaType))), is(expectedContent));
}
Expand Down

0 comments on commit a524c03

Please sign in to comment.