mardi 6 octobre 2020

When using Mockito verify failing on empty row

Tried to test my client with this following test:

private static final HttpPost EXPECTED_POST = new HttpPost(someURI);

    @Test
    public void sendingPostRequest() throws IOException {
        classUnderTest.takeParamsAndSend(REQUEST_STRING);
        verify(client).execute(EXPECTED_POST);
        verifyNoMoreInteractions(client);
    }

And in the production code it's something like this:

URI uri = createURI();
HttpPost post = new HttpPost(uri);
return client.execute(post);

The result is a "Comparison Failure" on the same execute and on the actual, there is an empty row. Looks something like this: expected:

"client.execute(
    POST somePostRequest HTTP/1.1
);"

actual:

"client.execute(
   POST somePostRequest HTTP/1.1
);
"

Aucun commentaire:

Enregistrer un commentaire