Class TCK

java.lang.Object
org.objenesis.tck.TCK

public class TCK extends 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:
  • Field Details

    • objenesisStandard

      private final Objenesis objenesisStandard
    • objenesisSerializer

      private final Objenesis objenesisSerializer
    • reporter

      private final Reporter reporter
    • candidates

      private final List<Candidate> candidates
  • Constructor Details

    • 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 Details

    • loadCandidates

      protected void loadCandidates() throws IOException
      Throws:
      IOException
    • registerCandidate

      public void registerCandidate(Class<?> candidateClass, 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.
    • runTest

      private void runTest(Reporter reporter, Class<?> candidate, Objenesis objenesis, Candidate.CandidateType type)
    • runFeature

      private void runFeature(Reporter reporter, Class<?> clazz, Objenesis objenesis, Candidate.CandidateType type)
    • runCandidate

      private void runCandidate(Reporter reporter, Class<?> candidate, Objenesis objenesis, Candidate.CandidateType type)
    • describePlatform

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