use of org.apache.http.StatusLine in project cdap-ingest by caskdata.
the class RestClientTest method testUnauthorizedResponseCodeAnalysis.
@Test
public void testUnauthorizedResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_UNAUTHORIZED, "Unauthorized");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_UNAUTHORIZED, response);
verify(response).getStatusLine();
}
use of org.apache.http.StatusLine in project cdap-ingest by caskdata.
the class RestClientTest method testNotAllowedResponseCodeAnalysis.
@Test
public void testNotAllowedResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_METHOD_NOT_ALLOWED, "Method Not Allowed");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_METHOD_NOT_ALLOWED, response);
verify(response, new VerificationMode() {
@Override
public void verify(VerificationData verificationData) {
Assert.assertEquals(2, verificationData.getAllInvocations().size());
}
}).getStatusLine();
}
use of org.apache.http.StatusLine in project cdap-ingest by caskdata.
the class RestClientTest method testNotFoundResponseCodeAnalysis.
@Test
public void testNotFoundResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_NOT_FOUND, "Not Found");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_NOT_FOUND, response);
verify(response).getStatusLine();
}
use of org.apache.http.StatusLine in project cdap-ingest by caskdata.
the class RestClientTest method testForbiddenResponseCodeAnalysis.
@Test
public void testForbiddenResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_FORBIDDEN, "Forbidden");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_FORBIDDEN, response);
verify(response).getStatusLine();
}
use of org.apache.http.StatusLine in project cdap-ingest by caskdata.
the class RestClientTest method testNotImplementedResponseCodeAnalysis.
@Test
public void testNotImplementedResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_NOT_IMPLEMENTED, "Not Implemented");
when(response.getStatusLine()).thenReturn(statusLine);
try {
RestClient.responseCodeAnalysis(response);
Assert.fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
}
verify(response).getStatusLine();
}
Aggregations