Enum TestMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<TestMode>

    public enum TestMode
    extends java.lang.Enum<TestMode>
    Test-run mode.

    Defined by the relation of one main and one test module name.

    
                              main plain    main module   main module
                                 ---            foo           bar
    
         test plain  ---          0              2             2
    
         test module foo          1              3             4
    
         test module bar          1              4             3
    
         0 = CLASSIC
         1 = MAIN_CLASSIC_TEST_MODULE           (black-box test) // CLASSIC_MODULAR_TEST
         2 = MAIN_MODULE_TEST_CLASSIC           (white-box test) // MODULAR_CLASSIC_TEST
         3 = MAIN_MODULE_TEST_MODULE_SAME_NAME  (white-box test) // MODULAR_PATCHED_TEST
         4 = MODULAR                            (black-box test) // MODULAR_BLACKBOX_TEST
     
    See Also:
    Access Modifier Table
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static TestMode of​(java.lang.String main, java.lang.String test)
      Get test mode based on two module names.
      java.lang.String toString()  
      static TestMode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static TestMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • CLASSIC

        public static final TestMode CLASSIC
        No modules at all, fall-back to the class-path.
      • MAIN_CLASSIC_TEST_MODULE

        public static final TestMode MAIN_CLASSIC_TEST_MODULE
        Main module absent, test module present.

        This mode is also to be selected when there is no main artifact available, i.e. main is empty.

        Note: A classic non-empty main source set is not supported by `maven-compiler-plugin` at the moment.

        
         Caused by: java.lang.UnsupportedOperationException:
           Can't compile test sources when main sources are missing a module descriptor at
           org.apache.maven.plugin.compiler.TestCompilerMojo.preparePaths (TestCompilerMojo.java:374)
           ...
         
      • MAIN_MODULE_TEST_CLASSIC

        public static final TestMode MAIN_MODULE_TEST_CLASSIC
        Main module present, test module absent.

        White-box testing by patching tests into the main module at test-runtime.

        This mode intentionally by-passes the modular barrier to allow access to internal types.

      • MAIN_MODULE_TEST_MODULE_SAME_NAME

        public static final TestMode MAIN_MODULE_TEST_MODULE_SAME_NAME
        Main module present, test module present: same module name.

        White-box testing by patching main types into the test module at compile-runtime.

        This mode intentionally by-passes the modular barrier to allow access to internal types.

      • MODULAR

        public static final TestMode MODULAR
        Main module present, test module present: different module name.

        Black-box testing the main module, adhering to its exported API.

    • Method Detail

      • values

        public static TestMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TestMode c : TestMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TestMode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • of

        public static TestMode of​(java.lang.String main,
                                  java.lang.String test)
        Get test mode based on two module names.
        Parameters:
        main - name of the main module
        test - name of the test module
        Returns:
        test mode constant based on both names
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<TestMode>