Class LifecycleMethodUtils


  • final class LifecycleMethodUtils
    extends java.lang.Object
    Collection of utilities for working with test lifecycle methods.
    Since:
    5.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String classTemplateInvocationLifecycleMethodAnnotationName​(java.lang.reflect.Method method)  
      private static org.junit.platform.engine.DiscoveryIssue createIssue​(org.junit.platform.engine.DiscoveryIssue.Severity severity, java.lang.String message, java.lang.reflect.Method method)  
      (package private) static java.util.List<java.lang.reflect.Method> findAfterAllMethods​(java.lang.Class<?> testClass, boolean requireStatic, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      (package private) static java.util.List<java.lang.reflect.Method> findAfterEachMethods​(java.lang.Class<?> testClass, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      private static java.util.stream.Stream<java.lang.reflect.Method> findAllClassTemplateInvocationLifecycleMethods​(java.lang.Class<?> testClass)  
      (package private) static java.util.List<java.lang.reflect.Method> findBeforeAllMethods​(java.lang.Class<?> testClass, boolean requireStatic, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      (package private) static java.util.List<java.lang.reflect.Method> findBeforeEachMethods​(java.lang.Class<?> testClass, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      private static java.util.Optional<org.junit.jupiter.api.extension.ClassTemplateInvocationLifecycleMethod> findClassTemplateInvocationLifecycleMethodAnnotation​(java.lang.reflect.Method method)  
      private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckNonStatic​(java.lang.Class<?> testClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.junit.platform.commons.support.HierarchyTraversalMode traversalMode, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckStatic​(java.lang.Class<?> testClass, boolean requireStatic, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.junit.platform.commons.support.HierarchyTraversalMode traversalMode, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckVoidReturnType​(java.lang.Class<?> testClass, java.lang.Class<? extends java.lang.annotation.Annotation> annotationType, org.junit.platform.commons.support.HierarchyTraversalMode traversalMode, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<? super java.lang.reflect.Method> additionalCondition)  
      private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotPrivateError​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotPrivateWarning​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter, java.util.function.Supplier<java.lang.String> annotationNameProvider)  
      private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotStatic​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter, java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)  
      private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isStatic​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter, java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)  
      private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> returnsPrimitiveVoid​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter, java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)  
      (package private) static void validateClassTemplateInvocationLifecycleMethodsAreDeclaredCorrectly​(java.lang.Class<?> testClass, boolean requireStatic, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      (package private) static void validateNoClassTemplateInvocationLifecycleMethodsAreDeclared​(java.lang.Class<?> testClass, org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LifecycleMethodUtils

        private LifecycleMethodUtils()
    • Method Detail

      • findBeforeAllMethods

        static java.util.List<java.lang.reflect.Method> findBeforeAllMethods​(java.lang.Class<?> testClass,
                                                                             boolean requireStatic,
                                                                             org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findAfterAllMethods

        static java.util.List<java.lang.reflect.Method> findAfterAllMethods​(java.lang.Class<?> testClass,
                                                                            boolean requireStatic,
                                                                            org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findBeforeEachMethods

        static java.util.List<java.lang.reflect.Method> findBeforeEachMethods​(java.lang.Class<?> testClass,
                                                                              org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findAfterEachMethods

        static java.util.List<java.lang.reflect.Method> findAfterEachMethods​(java.lang.Class<?> testClass,
                                                                             org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • validateNoClassTemplateInvocationLifecycleMethodsAreDeclared

        static void validateNoClassTemplateInvocationLifecycleMethodsAreDeclared​(java.lang.Class<?> testClass,
                                                                                 org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • validateClassTemplateInvocationLifecycleMethodsAreDeclaredCorrectly

        static void validateClassTemplateInvocationLifecycleMethodsAreDeclaredCorrectly​(java.lang.Class<?> testClass,
                                                                                        boolean requireStatic,
                                                                                        org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findAllClassTemplateInvocationLifecycleMethods

        private static java.util.stream.Stream<java.lang.reflect.Method> findAllClassTemplateInvocationLifecycleMethods​(java.lang.Class<?> testClass)
      • findMethodsAndCheckStatic

        private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckStatic​(java.lang.Class<?> testClass,
                                                                                          boolean requireStatic,
                                                                                          java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                                          org.junit.platform.commons.support.HierarchyTraversalMode traversalMode,
                                                                                          org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findMethodsAndCheckNonStatic

        private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckNonStatic​(java.lang.Class<?> testClass,
                                                                                             java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                                             org.junit.platform.commons.support.HierarchyTraversalMode traversalMode,
                                                                                             org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • findMethodsAndCheckVoidReturnType

        private static java.util.List<java.lang.reflect.Method> findMethodsAndCheckVoidReturnType​(java.lang.Class<?> testClass,
                                                                                                  java.lang.Class<? extends java.lang.annotation.Annotation> annotationType,
                                                                                                  org.junit.platform.commons.support.HierarchyTraversalMode traversalMode,
                                                                                                  org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter,
                                                                                                  org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<? super java.lang.reflect.Method> additionalCondition)
      • isStatic

        private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isStatic​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter,
                                                                                                                                       java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)
      • isNotStatic

        private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotStatic​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter,
                                                                                                                                          java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)
      • isNotPrivateError

        private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotPrivateError​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter)
      • isNotPrivateWarning

        private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> isNotPrivateWarning​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter,
                                                                                                                                                  java.util.function.Supplier<java.lang.String> annotationNameProvider)
      • returnsPrimitiveVoid

        private static org.junit.platform.engine.support.discovery.DiscoveryIssueReporter.Condition<java.lang.reflect.Method> returnsPrimitiveVoid​(org.junit.platform.engine.support.discovery.DiscoveryIssueReporter issueReporter,
                                                                                                                                                   java.util.function.Function<java.lang.reflect.Method,​java.lang.String> annotationNameProvider)
      • classTemplateInvocationLifecycleMethodAnnotationName

        private static java.lang.String classTemplateInvocationLifecycleMethodAnnotationName​(java.lang.reflect.Method method)
      • findClassTemplateInvocationLifecycleMethodAnnotation

        private static java.util.Optional<org.junit.jupiter.api.extension.ClassTemplateInvocationLifecycleMethod> findClassTemplateInvocationLifecycleMethodAnnotation​(java.lang.reflect.Method method)
      • createIssue

        private static org.junit.platform.engine.DiscoveryIssue createIssue​(org.junit.platform.engine.DiscoveryIssue.Severity severity,
                                                                            java.lang.String message,
                                                                            java.lang.reflect.Method method)