Usage
The jupiter extension offers annotations for hosting a mock repository manager as part of a Jupiter Test Lifecycle.
<project>
...
<dependencies>
...
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>mrm-jupiter-extension</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
...
</dependencies>
...
</project>
Basic Usage
Write your unit test as usual and annotate the class with @MockRepositoryManager. Tests that depend on the mock repository manager should add the MockRepositoryManagerServer parameter to their method.
To make use of of it, start writing a unit test as follows:
@MockRepositoryManager
class ExampleTest {
@Test
void example(MockRepositoryManagerServer server) {
}
}
Make sure to add at least 1 repository, see Repository Types where every different type is explained.
Security
By default the Mock Repository Manager is not secured, meaning that every for every http call you don't need to be authorized or even authenticated. Every existing resource will be served.
By adding users to the MockRepositoryManager annotation, every http call must contain a basic authorization header to access the resources.
@MockRepositoryManager(
users = @User(username = "john.doe", password = "s3cr3t"))
class ExampleTest {
@Test
void example(MockRepositoryManagerServer server) {
}
}


