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 5.1.0 introduces 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 = trueExample:
@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