diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Epic.java b/allure-java-commons/src/main/java/io/qameta/allure/Epic.java
index 851c90f5..11bbde20 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Epic.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Epic.java
@@ -31,7 +31,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@Repeatable(Epics.class)
@LabelAnnotation(name = EPIC_LABEL_NAME)
public @interface Epic {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Epics.java b/allure-java-commons/src/main/java/io/qameta/allure/Epics.java
index 2ea16dbd..3398af24 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Epics.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Epics.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Epics {
Epic[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Feature.java b/allure-java-commons/src/main/java/io/qameta/allure/Feature.java
index d938062b..cab64f92 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Feature.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Feature.java
@@ -31,7 +31,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@Repeatable(Features.class)
@LabelAnnotation(name = FEATURE_LABEL_NAME)
public @interface Feature {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Features.java b/allure-java-commons/src/main/java/io/qameta/allure/Features.java
index 8c80d639..11ac41ef 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Features.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Features.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Features {
Feature[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Flaky.java b/allure-java-commons/src/main/java/io/qameta/allure/Flaky.java
index f1fc2173..1ba58016 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Flaky.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Flaky.java
@@ -28,6 +28,6 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Flaky {
}
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Issue.java b/allure-java-commons/src/main/java/io/qameta/allure/Issue.java
index 9abe5561..90e1c9f9 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Issue.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Issue.java
@@ -31,7 +31,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@LinkAnnotation(type = ISSUE_LINK_TYPE)
@Repeatable(Issues.class)
public @interface Issue {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Issues.java b/allure-java-commons/src/main/java/io/qameta/allure/Issues.java
index c70da23d..87da1a80 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Issues.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Issues.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Issues {
Issue[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Link.java b/allure-java-commons/src/main/java/io/qameta/allure/Link.java
index d48f8b87..ab5b7181 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Link.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Link.java
@@ -37,7 +37,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@LinkAnnotation
@Repeatable(Links.class)
public @interface Link {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Links.java b/allure-java-commons/src/main/java/io/qameta/allure/Links.java
index b85c3985..c476daa3 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Links.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Links.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Links {
Link[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Muted.java b/allure-java-commons/src/main/java/io/qameta/allure/Muted.java
index 42ab5879..e2db9ac4 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Muted.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Muted.java
@@ -28,6 +28,6 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Muted {
}
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Owner.java b/allure-java-commons/src/main/java/io/qameta/allure/Owner.java
index cce5b56a..556eb9ca 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Owner.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Owner.java
@@ -33,7 +33,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@LabelAnnotation(name = OWNER_LABEL_NAME)
public @interface Owner {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Severity.java b/allure-java-commons/src/main/java/io/qameta/allure/Severity.java
index d34ca0e2..d16aac7b 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Severity.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Severity.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Severity {
SeverityLevel value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Stories.java b/allure-java-commons/src/main/java/io/qameta/allure/Stories.java
index 9e990597..00e11892 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Stories.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Stories.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface Stories {
Story[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/Story.java b/allure-java-commons/src/main/java/io/qameta/allure/Story.java
index 929485db..1f50eee3 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/Story.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/Story.java
@@ -31,7 +31,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@Repeatable(Stories.class)
@LabelAnnotation(name = STORY_LABEL_NAME)
public @interface Story {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/TmsLink.java b/allure-java-commons/src/main/java/io/qameta/allure/TmsLink.java
index f4f3b68d..0cb821fb 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/TmsLink.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/TmsLink.java
@@ -31,7 +31,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
@LinkAnnotation(type = TMS_LINK_TYPE)
@Repeatable(TmsLinks.class)
public @interface TmsLink {
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/TmsLinks.java b/allure-java-commons/src/main/java/io/qameta/allure/TmsLinks.java
index f364bab7..f88ff1d8 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/TmsLinks.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/TmsLinks.java
@@ -28,7 +28,7 @@
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD, ElementType.TYPE})
+@Target({ElementType.METHOD, ElementType.TYPE, ElementType.PACKAGE})
public @interface TmsLinks {
TmsLink[] value();
diff --git a/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java b/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
index d241a468..6a549dd2 100644
--- a/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
+++ b/allure-java-commons/src/main/java/io/qameta/allure/util/AnnotationUtils.java
@@ -29,8 +29,10 @@
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.BiFunction;
@@ -39,7 +41,11 @@
import static io.qameta.allure.util.ResultsUtils.createLabel;
import static io.qameta.allure.util.ResultsUtils.createLink;
+import static java.lang.String.join;
import static java.util.Arrays.asList;
+import static java.util.Arrays.copyOfRange;
+import static java.util.Arrays.stream;
+import static java.util.Optional.ofNullable;
/**
* Collection of utils used by Allure integration to extract meta information from
@@ -64,7 +70,7 @@ private AnnotationUtils() {
* @return true if {@link io.qameta.allure.Flaky} annotation is present, false otherwise.
*/
public static boolean isFlaky(final AnnotatedElement annotatedElement) {
- return annotatedElement.isAnnotationPresent(Flaky.class);
+ return isAnnotationPresent(annotatedElement, Flaky.class);
}
/**
@@ -74,7 +80,7 @@ public static boolean isFlaky(final AnnotatedElement annotatedElement) {
* @return true if {@link io.qameta.allure.Muted} annotation is present, false otherwise.
*/
public static boolean isMuted(final AnnotatedElement annotatedElement) {
- return annotatedElement.isAnnotationPresent(Muted.class);
+ return isAnnotationPresent(annotatedElement, Muted.class);
}
/**
@@ -84,7 +90,7 @@ public static boolean isMuted(final AnnotatedElement annotatedElement) {
* @return discovered links.
*/
public static Set getLinks(final AnnotatedElement annotatedElement) {
- return getLinks(annotatedElement.getAnnotations());
+ return getLinks(getAnnotationsFrom(annotatedElement));
}
/**
@@ -116,7 +122,7 @@ public static Set getLinks(final Collection annotations) {
* @return discovered labels.
*/
public static Set