diff --git a/archunit-junit/junit5/engine/src/main/java/com/tngtech/archunit/junit/internal/ArchUnitSystemPropertyTestFilterJUnit5.java b/archunit-junit/junit5/engine/src/main/java/com/tngtech/archunit/junit/internal/ArchUnitSystemPropertyTestFilterJUnit5.java index ae9c3f12c..fcb9dc951 100644 --- a/archunit-junit/junit5/engine/src/main/java/com/tngtech/archunit/junit/internal/ArchUnitSystemPropertyTestFilterJUnit5.java +++ b/archunit-junit/junit5/engine/src/main/java/com/tngtech/archunit/junit/internal/ArchUnitSystemPropertyTestFilterJUnit5.java @@ -48,7 +48,7 @@ private void removeNonMatching(TestDescriptor descriptor, Predicate removeNonMatching(child, shouldRunPredicate)); - if (descriptor.getChildren().isEmpty() && !shouldRunPredicate.test(descriptor)) { + if (!descriptor.isRoot() && descriptor.getChildren().isEmpty() && !shouldRunPredicate.test(descriptor)) { descriptor.removeFromHierarchy(); } }