use of com.endava.cats.model.CatsResponse in project cats by Endava.
the class BaseHeadersFuzzerTest method givenAConcreteBaseHeadersFuzzerInstanceWithMandatoryHeader_whenExecutingTheFuzzMethod_thenTheFuzzingLogicIsProperlyExecuted.
@Test
void givenAConcreteBaseHeadersFuzzerInstanceWithMandatoryHeader_whenExecutingTheFuzzMethod_thenTheFuzzingLogicIsProperlyExecuted() {
Map<String, List<String>> responses = new HashMap<>();
responses.put("200", Collections.singletonList("response"));
FuzzingData data = FuzzingData.builder().headers(Collections.singleton(CatsHeader.builder().name("header").value("value").required(true).build())).responseCodes(Sets.newHashSet("200", "202")).reqSchema(new StringSchema()).responses(responses).build();
CatsResponse catsResponse = CatsResponse.builder().body("{}").responseCode(200).build();
Mockito.when(serviceCaller.call(Mockito.any())).thenReturn(catsResponse);
Mockito.doNothing().when(testCaseListener).reportResult(Mockito.any(), Mockito.eq(data), Mockito.any(), Mockito.any());
baseHeadersFuzzer.fuzz(data);
Mockito.verify(testCaseListener).reportResult(Mockito.any(), Mockito.eq(data), Mockito.eq(catsResponse), Mockito.eq(ResponseCodeFamily.FOURXX), Mockito.eq(true));
}
use of com.endava.cats.model.CatsResponse in project cats by Endava.
the class BaseHeadersFuzzerTest method givenAConcreteBaseHeadersFuzzerInstanceWithNoMandatoryHeader_whenExecutingTheFuzzMethod_thenTheFuzzingLogicIsProperlyExecuted.
@Test
void givenAConcreteBaseHeadersFuzzerInstanceWithNoMandatoryHeader_whenExecutingTheFuzzMethod_thenTheFuzzingLogicIsProperlyExecuted() {
Map<String, List<String>> responses = new HashMap<>();
responses.put("200", Collections.singletonList("response"));
FuzzingData data = FuzzingData.builder().headers(Collections.singleton(CatsHeader.builder().name("header").value("value").build())).responses(responses).responseCodes(Sets.newHashSet("200", "202")).reqSchema(new StringSchema()).build();
CatsResponse catsResponse = CatsResponse.builder().body("{}").responseCode(200).build();
Mockito.when(serviceCaller.call(Mockito.any())).thenReturn(catsResponse);
baseHeadersFuzzer.fuzz(data);
Mockito.verify(testCaseListener).reportResult(Mockito.any(), Mockito.eq(data), Mockito.eq(catsResponse), Mockito.eq(ResponseCodeFamily.TWOXX), Mockito.eq(true));
}
Aggregations