Search in sources :

Example 1 with VerificationData

use of org.mockito.internal.verification.api.VerificationData 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();
}
Also used : BasicStatusLine(org.apache.http.message.BasicStatusLine) StatusLine(org.apache.http.StatusLine) ProtocolVersion(org.apache.http.ProtocolVersion) VerificationMode(org.mockito.verification.VerificationMode) VerificationData(org.mockito.internal.verification.api.VerificationData) BasicStatusLine(org.apache.http.message.BasicStatusLine) Test(org.junit.Test)

Aggregations

ProtocolVersion (org.apache.http.ProtocolVersion)1 StatusLine (org.apache.http.StatusLine)1 BasicStatusLine (org.apache.http.message.BasicStatusLine)1 Test (org.junit.Test)1 VerificationData (org.mockito.internal.verification.api.VerificationData)1 VerificationMode (org.mockito.verification.VerificationMode)1