Fork me on GitHub

Demo Project

Build and Run

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
        

Annotation-Based Tests (Recommended)

BRUT 5.1.0 introduces annotation-based testing with JUnit 5 parameter injection:

  • ZeroConfigJaxrsTest: Zero-config JAX-RS test with auto-detected bean packages
  • AnnotationBasedJaxrsTest: JAX-RS test with explicit configuration
  • AnnotationBasedPageModelTest: Page Model API test with annotations
  • AnnotationBasedComponentTest: HST Component test with annotations
  • ConfigServiceAnnotationJaxrsTest: ConfigServiceRepository with loadProjectContent = true

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");
    }
}
          

Legacy Tests

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)

Running Tests

Run all tests in the demo project:


          $ cd demo
          $ mvn test