Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.56 KB

README.adoc

File metadata and controls

38 lines (28 loc) · 1.56 KB

CDI Language Model TCK

The Language Model TCK does not depend on any test framework or test runner. Assertions are made using Java assert. The tests are executed in an implementation-defined manner.

To run the Language Model TCK, implementations must call the org.jboss.cdi.lang.model.tck.LangModelVerifier#verify() static method and pass it a ClassInfo object for the LangModelVerifier class. The way how this method is called and how the ClassInfo object is obtained are not specified, so that implementations are free to use whatever works best for them. Two conditions must be satisfied:

  • assertions are enabled;

  • the language model under test is configured to only return runtime-retained annotations.

If the verify method returns successfully, the TCK passed. If it throws an exception, the TCK failed.

To aid with debugging, the verify method prints a message to the JVM standard output in case of a success.

Recommendation

For CDI implementations, it is easiest to run the Language Model TCK using a build compatible extension. For example:

public class LangModelVerifierExtension implements BuildCompatibleExtension {
    @Enhancement(types = LangModelVerifier.class, withAnnotations = Annotation.class)
    public void run(ClassInfo clazz) {
        LangModelVerifier.verify(clazz);
    }
}

TODO

The Language Model API includes support for Java 16 records, but the TCK doesn’t test that. For now, that seems fine, because CDI doesn’t really care about records. This deficiency will have to be resolved in some way in the future.