December 2019
Intermediate to advanced
314 pages
6h 51m
English
As a bonus tip, we will show you how to activate the H2 database during the test life cycle. This can be done by adding a class, annotated as @QuarkusTestResource, to your test classes while passing the H2DatabaseTestResource class as an attribute.
Here is an example:
@QuarkusTestResource(H2DatabaseTestResource.class)public class TestResources {}
H2DatabaseTestResource basically performs the same actions that DBLifeCycleBean does, before our tests are fired. Note that the following dependency has been added into the project to run the preceding test class:
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-test-h2</artifactId> <scope>test</scope></dependency>
Now, you can safely run tests against ...
Read now
Unlock full access