Class TCK


  • public class TCK
    extends java.lang.Object
    Technology Compatibility Kit (TCK) for Objenesiss.

    This TCK tests Objenesis implementations against a set of candidate classes (class it attempts to instantiate), reporting the results to a Reporter.

    Example usage

     TextReporter reporter = new TextReporter(System.out, System.err);
     TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), reporter);
     tck.runTests(reporter);
     reporter.printResults();
     
    See Also:
    ObjectInstantiator, Reporter, Main
    • Field Detail

      • objenesisStandard

        private final Objenesis objenesisStandard
      • objenesisSerializer

        private final Objenesis objenesisSerializer
      • reporter

        private final Reporter reporter
      • candidates

        private final java.util.List<Candidate> candidates
    • Constructor Detail

      • TCK

        public TCK​(Objenesis objenesisStandard,
                   Objenesis objenesisSerializer,
                   Reporter reporter)
        Parameters:
        objenesisStandard - Objenesis instance used to instantiate classes the standard way (no constructor called)
        objenesisSerializer - Objenesis instance used to instantiate classes in a serialization compliant way (first not serializable constructor called)
        reporter - Where to report the results of the tests to
    • Method Detail

      • loadCandidates

        protected void loadCandidates()
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • registerCandidate

        public void registerCandidate​(java.lang.Class<?> candidateClass,
                                      java.lang.String description,
                                      Candidate.CandidateType type)
        Register a candidate class to attempt to instantiate.
        Parameters:
        candidateClass - Class to attempt to instantiate
        description - Description of the class
      • runTests

        public void runTests()
        Run all TCK tests.
      • describePlatform

        protected java.lang.String describePlatform()
        Describes the platform. Outputs Java version and vendor. To change this behavior, override this method.
        Returns:
        Description of the current platform