use of com.endava.cats.model.FuzzingStrategy in project cats by Endava.
the class CommonWithinMethodsTest method shouldReturnFullZalgoTextWhenMaxLengthNull.
@Test
void shouldReturnFullZalgoTextWhenMaxLengthNull() {
StringSchema schema = new StringSchema();
FuzzingStrategy fuzzingStrategy = CommonWithinMethods.getTextBasedOnMaxSize(schema, CommonWithinMethods.ZALGO_TEXT);
Assertions.assertThat(fuzzingStrategy.getData()).isEqualTo(CommonWithinMethods.ZALGO_TEXT);
}
use of com.endava.cats.model.FuzzingStrategy in project cats by Endava.
the class CommonWithinMethodsTest method shouldInsertWithoutReplaceWhenNotMaintainSize.
@Test
void shouldInsertWithoutReplaceWhenNotMaintainSize() {
StringSchema schema = new StringSchema();
int length = 10;
schema.setMinLength(length);
schema.setMaxLength(length);
FuzzingData fuzzingData = Mockito.mock(FuzzingData.class);
Map<String, Schema> reqPropTypes = Map.of("test1", schema);
Mockito.when(fuzzingData.getRequestPropertyTypes()).thenReturn(reqPropTypes);
List<FuzzingStrategy> fuzzingStrategyList = CommonWithinMethods.getFuzzingStrategies(fuzzingData, "test1", List.of(YY), false);
Assertions.assertThat(fuzzingStrategyList).hasSize(1);
Assertions.assertThat(fuzzingStrategyList.get(0).getData()).contains(YY).doesNotStartWith(YY).doesNotEndWith(YY).hasSize(length + YY.length());
}
use of com.endava.cats.model.FuzzingStrategy in project cats by Endava.
the class CommonWithinMethodsTest method shouldReturnFullZalgoTextWhenMaxLengthGreaterThenZalgoText.
@Test
void shouldReturnFullZalgoTextWhenMaxLengthGreaterThenZalgoText() {
StringSchema schema = new StringSchema();
schema.setMaxLength(1000);
FuzzingStrategy fuzzingStrategy = CommonWithinMethods.getTextBasedOnMaxSize(schema, CommonWithinMethods.ZALGO_TEXT);
Assertions.assertThat(fuzzingStrategy.getData()).isEqualTo(CommonWithinMethods.ZALGO_TEXT);
}
use of com.endava.cats.model.FuzzingStrategy in project cats by Endava.
the class CommonWithinMethodsTest method shouldInsertWithoutReplaceWhenEnums.
@Test
void shouldInsertWithoutReplaceWhenEnums() {
StringSchema schema = new StringSchema();
schema.setEnum(List.of("ENUM"));
FuzzingData fuzzingData = Mockito.mock(FuzzingData.class);
Map<String, Schema> reqPropTypes = Map.of("test2", schema);
Mockito.when(fuzzingData.getRequestPropertyTypes()).thenReturn(reqPropTypes);
List<FuzzingStrategy> fuzzingStrategyList = CommonWithinMethods.getFuzzingStrategies(fuzzingData, "test2", List.of(YY), false);
Assertions.assertThat(fuzzingStrategyList).hasSize(1);
Assertions.assertThat(fuzzingStrategyList.get(0).getData()).isEqualTo("EN" + YY + "UM");
}
use of com.endava.cats.model.FuzzingStrategy in project cats by Endava.
the class CommonWithinMethodsTest method shouldReturnMaxLengthZalgoText.
@Test
void shouldReturnMaxLengthZalgoText() {
StringSchema schema = new StringSchema();
schema.setMaxLength(100);
FuzzingStrategy fuzzingStrategy = CommonWithinMethods.getTextBasedOnMaxSize(schema, CommonWithinMethods.ZALGO_TEXT);
Assertions.assertThat(fuzzingStrategy.getData()).isEqualTo(CommonWithinMethods.ZALGO_TEXT.substring(0, 100));
}
Aggregations