Sureassert Exemplars are great for unit testing the contracts of your methods, and will often satisfy most of your project’s unit testing requirements. But there are unit test scenarios that cannot be achieved using method-contract based testing alone. Sometimes you need to execute tests that orchestrate calls across a number of methods and make complex assertions, and these must be coded within a separate test class.
Sureassert UC allows you to associate JUnit test classes with your application classes using the @HasJUnit annotation. JUnits in the associated test class will then be executed by the Sureassert UC Engine whenever code that affects the tests is modified, and the results indicated using error and warning markers in the same manner as for @Exemplars. JUnit tests run by the engine leverage all the stubbing functionality offered by Sureassert UC and can define their own stubs using the @Stubs annotation on JUnit test methods.
Alternatively, the Sureassert UC engine can control all JUnit tests defined within your project, running them automatically whenever any affected code is modified.
The UC engine will attempt to run JUnits using whatever JUnit library is present on your project’s classpath, however stubbing is not supported when using JUnit 4.5 and below. JUnit versions 3.x and below are not supported.