You can build and install the module locally first in the project root folder.
$ mvn clean install
And you can build and run the Demo project:
$ cd demo
$ mvn clean verify && mvn -Pcargo.run
BRUT annotation-based testing with JUnit 5 parameter injection:
ZeroConfigJaxrsTest: Zero-config JAX-RS test with auto-detected bean packagesAnnotationBasedJaxrsTest: JAX-RS test with explicit configurationAnnotationBasedPageModelTest: Page Model API test with annotationsAnnotationBasedComponentTest: HST Component test with annotationsConfigServiceAnnotationJaxrsTest: ConfigServiceRepository with loadProjectContent = trueConfigServiceAnnotationEssentialsListComponentTest: ConfigServiceRepository test demonstrating addon HCM module auto-discovery — no dependencyHcmModules annotation parameter neededAddon HCM Modules: Tests using loadProjectContent = true automatically
benefit from zero-config addon discovery. Any non-platform, non-project JAR with
META-INF/hcm-module.yaml on the test classpath is loaded without additional annotation
parameters.
Example:
@BrxmJaxrsTest(
beanPackages = {"org.example.model"},
resources = {HelloResource.class}
)
class ZeroConfigJaxrsTest {
@Test
void testEndpoint(DynamicJaxrsTest brxm) {
brxm.request()
.get("/site/api/hello/world")
.assertBody("Hello, World! world");
}
}
For reference, the demo project also includes tests using the legacy abstract class approach:
EssentialsListComponentTest: HST Component Test (extends AbstractComponentTest)JaxrsTest: Plain JAX-RS RESTful API Test (extends AbstractJaxrsTest)PageModelTest: Delivery Page Model API Test (extends AbstractPageModelTest)Run all tests in the demo project:
$ cd demo
$ mvn test