use of com.avaloq.tools.ddk.check.check.XIssueExpression in project dsl-devkit by dsldevkit.
the class CheckMarkerHelpExtensionTest method testCheckHasTwoIssueCodes.
/**
* Tests if a marker help element is added if an additional issueCode is added to an existing check.
*
* @throws Exception
* the exception
*/
@Test
public void testCheckHasTwoIssueCodes() throws Exception {
IPluginExtension extension = createMarkerHelpExtension(parser.parse(CATALOG_WITH_FIRST_CHECK_LIVE));
CheckCatalog twoIssueCodes = parser.parse(CATALOG_CHECK_HAS_TWO_ISSUECODES);
markerUtil.updateExtension(twoIssueCodes, extension);
List<String> issueCodesOfCheck = Lists.newArrayList();
for (final XIssueExpression i : generatorExtension.issues(twoIssueCodes.getChecks().get(0))) {
issueCodesOfCheck.add(CheckGeneratorExtensions.issueCodeValue(twoIssueCodes.getChecks().get(0), CheckGeneratorExtensions.issueCode(i)));
}
List<String> issueCodesInExtension = Lists.newArrayList();
for (IPluginObject obj : extension.getChildren()) {
for (IPluginObject element : ((IPluginElement) obj).getChildren()) {
issueCodesInExtension.add(((IPluginElement) element).getAttribute(CheckMarkerHelpExtensionHelper.ATTRIBUTE_VALUE_TAG).getValue());
}
}
assertTrue("A marker help element for both issueCodes has been created.", Iterables.elementsEqual(issueCodesInExtension, issueCodesOfCheck));
assertEquals("extension has two marker help elements", 2, issueCodesInExtension.size());
}
Aggregations