use of com.devonfw.cobigen.openapiplugin.matcher.OpenAPIMatcher in project cobigen by devonfw.
the class OpenAPIMatcherTest method testInvalidEntityDefMatching.
/**
* Test non valid {@link EntityDef} matching
*/
@Test
public void testInvalidEntityDefMatching() {
EntityDef entityDef = new EntityDef();
entityDef.setComponentName("Tablemanagement");
OpenAPIMatcher matcher = new OpenAPIMatcher();
boolean matches = matcher.matches(new MatcherTo("element", "EntityDefs", entityDef));
assertThat(matches).isFalse();
}
use of com.devonfw.cobigen.openapiplugin.matcher.OpenAPIMatcher in project cobigen by devonfw.
the class OpenAPIMatcherTest method testMissingXRootPackageVariableMandatory.
/**
* Test if the generation isn't successful and the report contains errors, if a mandatory variable isn't given
*/
@Test
public void testMissingXRootPackageVariableMandatory() {
ComponentDef componentDef = new ComponentDef();
componentDef.setName("Tablemanagement");
OpenAPIMatcher matcher = new OpenAPIMatcher();
GenerationReportTo report = new GenerationReportTo();
List<VariableAssignmentTo> vaMandatoryXRootPackage = new ArrayList<>();
vaMandatoryXRootPackage.add(new VariableAssignmentTo("extension", "rootPackage", "x-rootpackage", true));
matcher.resolveVariables(new MatcherTo("element", "ComponentDef", componentDef), vaMandatoryXRootPackage, report);
assertThat(report.getErrors().get(0).getMessage()).containsSequence(Constants.getMandatoryMessage(true, "x-rootpackage"));
}
Aggregations