jeudi 25 mars 2021

Unable to mock class in method Level in Integration Test

Xservie servie= Mockito.mock(servie.class);

String expected = "{"httpCode":"502 BAD_GATEWAY","message":"BAD_GATEWAY","code":"123"}";

Mockito.when(servie.getActiveData(any(Optional.class), any(Optional.class))) .thenThrow(BadGateway.class);

Mockito.when(servie.findById(any(String.class))).thenThrow(BadGateway.class);

assertEquals(HttpStatus.BAD_GATEWAY, response.getStatusCode());

assertEquals(expected, response.getBody());

Aucun commentaire:

Enregistrer un commentaire