use of com.endava.cats.dsl.CatsDSLParser in project cats by Endava.
the class CatsUtilTest method shouldAddTopElement.
@Test
void shouldAddTopElement() {
CatsUtil catsUtil = new CatsUtil(new CatsDSLParser());
String payload = "{\"field\":\"value\", \"anotherField\":{\"subfield\": \"otherValue\"}}";
Map<String, String> currentPathValues = Collections.singletonMap("additionalProperties", "{topElement=metadata, mapValues={test1=value1,test2=value2}}");
String updatedPayload = catsUtil.setAdditionalPropertiesToPayload(currentPathValues, payload);
Assertions.assertThat(updatedPayload).contains("metadata").contains("test1");
}
use of com.endava.cats.dsl.CatsDSLParser in project cats by Endava.
the class CatsUtilTest method givenAYamlFile_whenParseYamlIsCalled_thenTheYamlFileIsProperlyParsed.
@Test
void givenAYamlFile_whenParseYamlIsCalled_thenTheYamlFileIsProperlyParsed() throws Exception {
CatsUtil catsUtil = new CatsUtil(new CatsDSLParser());
Map<String, Map<String, Object>> yaml = catsUtil.parseYaml("src/test/resources/test.yml");
Assertions.assertThat(yaml.get("all")).isNotNull();
Assertions.assertThat(yaml.get("all").get("Authorization")).isNotNull();
}
Aggregations