use of com.devonfw.cobigen.openapiplugin.model.ComponentDef in project cobigen by devonfw.
the class OpenAPIInputReaderTest method testRetrievePathsOfComponent.
@Test
public void testRetrievePathsOfComponent() throws Exception {
List<Object> inputObjects = getInputs("two-components.yaml");
List<ComponentDef> cmps = new LinkedList<>();
for (Object o : inputObjects) {
if (isComponentDef(o)) {
cmps.add(((ComponentDef) o));
} else {
cmps.add(((EntityDef) o).getComponent());
}
}
assertThat(cmps).extracting("paths").hasSize(4);
List<String> pathURIs = new LinkedList<>();
for (ComponentDef cmp : cmps) {
for (PathDef path : cmp.getPaths()) {
pathURIs.add(path.getPathURI());
}
}
assertThat(pathURIs).hasSize(10);
assertThat(pathURIs).containsExactly("/table/{id}/", "/table/new/", "/sale/{id}/", "/sale/{bla}/", "/sale/", "/table/{id}/", "/table/new/", "/sale/{id}/", "/sale/{bla}/", "/sale/");
}
Aggregations