private boolean testMethodMatchesAPositiveTag(Class<?> testClass, String methodName, List<TestTag> expectedTags) { List<TestTag> tags = TestAnnotations.forClass(testClass).getTagsForMethod(methodName); return containsAPositiveMatch(expectedTags, tags); }
public boolean isIgnored(final String methodName) { java.util.Optional<Method> method = getMethodCalled(methodName); return method.isPresent() && isIgnored(method.get()); }
public boolean isPending(final String methodName) { Optional<Method> method = getMethodCalled(methodName); return method.isPresent() && isPending(method.get()); }
List<String> getIssuesForMethod(String methodName) { List<String> issues = new ArrayList<>(); if (testClass != null) { addIssuesFromMethod(methodName, issues); } else { addIssuesFromTestScenarioName(methodName, issues); } return issues; }
private void addIssuesFromMethod(String methodName, List<String> issues) { if (getAnnotatedIssues(methodName) != null) { issues.addAll(Arrays.asList(getAnnotatedIssues(methodName))); } if (getAnnotatedIssue(methodName).isPresent()) { issues.add(getAnnotatedIssue(methodName).get()); } if (getAnnotatedTitle(methodName) != null) { addIssuesFromTestScenarioName(methodName, issues); } }
jsonObject.add(CLASSNAME, new JsonPrimitive(src.getName())); JsonArray issuesJsonArray = new JsonArray(); TestAnnotations testAnnotationsForClass = TestAnnotations.forClass(src); String[] annotatedIssuesForTestCase = testAnnotationsForClass.getAnnotatedIssuesForTestCase(src); addIssuesToCollectingJsonArray(issuesJsonArray, annotatedIssuesForTestCase); String annotatedIssueForTestCase = testAnnotationsForClass.getAnnotatedIssueForTestCase(src); if (annotatedIssueForTestCase != null) { issuesJsonArray.add(new JsonPrimitive(annotatedIssueForTestCase)); .getAnnotatedIssuesForMethod(currentMethod.getName()); addIssuesToCollectingJsonArray(issuesJsonArray, annotatedIssuesForMethod); Optional<String> annotatedIssueForMethod = testAnnotationsForClass .getAnnotatedIssueForMethod(currentMethod.getName()); if (annotatedIssueForMethod.isPresent()) { issuesJsonArray.add(new JsonPrimitive(
private List<TestTag> getTags(Class<?> testClass) { List<TestTag> tags = new ArrayList<>(); if (testClass == null) { return NO_TAGS; } addTagValues(tags, testClass.getAnnotation(WithTagValuesOf.class)); addTags(tags, testClass.getAnnotation(WithTags.class)); addTag(tags, testClass.getAnnotation(WithTag.class)); if (testClass.getSuperclass() != Object.class) { tags.addAll(getTags(testClass.getSuperclass())); } return tags; }
private List<TestTag> getTagsFor(String methodName) { List<TestTag> tags = new ArrayList<TestTag>(); Optional<Method> testMethod = getMethodCalled(methodName); if (testMethod.isPresent()) { addTagValues(tags, testMethod.get().getAnnotation(WithTagValuesOf.class)); addTags(tags, testMethod.get().getAnnotation(WithTags.class)); addTag(tags, testMethod.get().getAnnotation(WithTag.class)); } return tags; }
private void addMethodLevelIssuesTo(List<String> issues) { Optional<String> issue = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedIssueForMethod(testOutcome.getName()); if (issue.isPresent()) { issues.add(issue.get()); } String[] multipleIssues = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedIssuesForMethod(testOutcome.getName()); issues.addAll(Arrays.asList(multipleIssues)); }
private void addClassLevelIssuesTo(List<String> issues) { String classIssue = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedIssueForTestCase(testOutcome.getTestCase()); if (classIssue != null) { issues.add(classIssue); } String[] classIssues = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedIssuesForTestCase(testOutcome.getTestCase()); if (classIssues != null) { issues.addAll(Arrays.asList(classIssues)); } }
private void setDefaultResultFromAnnotations(final TestStep step, final ExecutedStepDescription description) { if (TestAnnotations.isPending(description.getTestMethod())) { step.setResult(TestResult.PENDING); } if (TestAnnotations.isIgnored(description.getTestMethod())) { step.setResult(TestResult.IGNORED); } }
private void addMethodLevelVersionsTo(List<String> versions) { Optional<String> version = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedVersionForMethod(testOutcome.getName()); if (version.isPresent()) { versions.add(version.get()); } }
private static void addClassLevelVersionsTo(TestOutcome testOutcome, List<String> versions) { String classVersion = TestAnnotations.forClass(testOutcome.getTestCase()).getAnnotatedVersionForTestCase(testOutcome.getTestCase()); if (classVersion != null) { versions.add(classVersion); } }
private String getBaseTitleFromAnnotationOrMethodName() { Optional<String> annotatedTitle = TestAnnotations.forClass(testCase).getAnnotatedTitleForMethod(name); return annotatedTitle.or(NameConverter.humanize(withNoArguments(name))); }
public boolean isIgnored() { return TestAnnotations.isIgnored(method); } }
public List<TestTag> getTagsForMethod(String methodName) { List<TestTag> allTags = new ArrayList<>(getTags()); allTags.addAll(getTagsFor(methodName)); return ImmutableList.copyOf(allTags); }