use of gherkin.formatter.model.Tag in project cucumber-jvm by cucumber.
the class JavaHookTest method does_not_match_non_matching_tags.
@Test
public void does_not_match_non_matching_tags() {
objectFactory.setInstance(new HasHooks());
backend.buildWorld();
backend.addHook(BEFORE.getAnnotation(Before.class), BEFORE);
HookDefinition before = glue.getBeforeHooks().get(0);
assertFalse(before.matches(asList(new Tag("@bar", 0))));
}
use of gherkin.formatter.model.Tag in project allure-cucumberjvm by allure-framework.
the class AllureReporter method getSeverityLevel.
private SeverityLevel getSeverityLevel(Scenario scenario) {
SeverityLevel level = null;
List<SeverityLevel> severityLevels = Arrays.asList(SeverityLevel.BLOCKER, SeverityLevel.CRITICAL, SeverityLevel.NORMAL, SeverityLevel.MINOR, SeverityLevel.TRIVIAL);
for (Tag tag : scenario.getTags()) {
Matcher matcher = SEVERITY_PATTERN.matcher(tag.getName());
if (matcher.matches()) {
SeverityLevel levelTmp;
String levelString = matcher.group(1);
try {
levelTmp = SeverityLevel.fromValue(levelString.toLowerCase());
} catch (IllegalArgumentException e) {
LOG.warn(String.format("Unexpected Severity level [%s]. SeverityLevel.NORMAL will be used instead", levelString), e);
levelTmp = SeverityLevel.NORMAL;
}
if (level == null || severityLevels.indexOf(levelTmp) < severityLevels.indexOf(level)) {
level = levelTmp;
}
}
}
return level;
}
Aggregations