Skip to content

Commit

Permalink
Remove unnecessary GIVEN/WHEN/THEN test comments (#33384)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbismuth committed Oct 31, 2018
1 parent 40a59bc commit c168b67
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,22 @@ public static void cleanupReferences() {
}

public void testRestGetSourceAction() throws Exception {
// GIVEN a REST Get Source action response with an existing result and a non-null source
final BytesReference source = new BytesArray("{\"foo\": \"bar\"}");
final GetResponse getResponse = new GetResponse(new GetResult("index1", "_doc", "1", -1, true, source, emptyMap()));

// WHEN building the REST response
final RestResponse restResponse = listener.buildResponse(getResponse);

// THEN expect to retrieve document source
assertThat(restResponse.status(), equalTo(OK));
assertThat(restResponse.contentType(), equalTo("application/json; charset=UTF-8"));
assertThat(restResponse.content(), equalTo(new BytesArray("{\"foo\": \"bar\"}")));
}

public void testRestGetSourceActionWithNullSource() {
// GIVEN a REST Get Source action response with a non-existing result and a null source
final GetResponse getResponse = new GetResponse(new GetResult("index1", "_doc", "1", -1, false, null, emptyMap()));

// WHEN building the REST response
// THEN expect a resource not found exception
final ResourceNotFoundException exception = expectThrows(ResourceNotFoundException.class,
() -> listener.buildResponse(getResponse));

// THEN expect a formatted error message
assertThat(exception.getMessage(), equalTo("Document or source not found [index1]/[_doc]/[1]"));
}
}

0 comments on commit c168b67

Please sign in to comment.