Setup
RECORDO
Maven Dependencies
You can include individual modules as needed or add all modules at once using the recordo-all
artifact.
All Modules
To include all modules:
<dependency>
<groupId>com.cariochi.recordo</groupId>
<artifactId>recordo-all</artifactId>
<version><!-- Use the latest version --></version>
<type>pom</type>
<scope>test</scope>
</dependency>
Individual Modules
Alternatively, you can include any of the following modules separately:
<!-- Read Module -->
<dependency>
<groupId>com.cariochi.recordo</groupId>
<artifactId>recordo-read</artifactId>
<version><!-- Use the latest version --></version>
<scope>test</scope>
</dependency>
<!-- Assertions Module -->
<dependency>
<groupId>com.cariochi.recordo</groupId>
<artifactId>recordo-assertions</artifactId>
<version><!-- Use the latest version --></version>
<scope>test</scope>
</dependency>
<!-- MockMvc Module -->
<dependency>
<groupId>com.cariochi.recordo</groupId>
<artifactId>recordo-spring-mockmvc</artifactId>
<version><!-- Use the latest version --></version>
<scope>test</scope>
</dependency>
<!-- MockServer Module -->
<dependency>
<groupId>com.cariochi.recordo</groupId>
<artifactId>recordo-mockserver</artifactId>
<version><!-- Use the latest version --></version>
<scope>test</scope>
</dependency>
You can find the latest version on Maven Repository.
Compatibility
Versions 1.x.x: Compatible with Java 11+ and Spring 5.x (Spring Boot 2.x).
Versions 2.x.x: Compatible with Java 17+ and Spring 6.x (Spring Boot 3.x).
Important Note: Three of the four modules (recordo-read
, recordo-assertions
, and recordo-mockserver
) can be used in projects that do not utilize the Spring Framework. Only recordo-spring-mockmvc
requires Spring.
Initialize Extension
To set up Recordo for your test, simply use the RecordoExtension
.
@ExtendWith(RecordoExtension.class)
class BookServiceTest {
...
}
ObjectMapper
Recordo uses the Jackson ObjectMapper for JSON operations. The logic for locating the ObjectMapper instance is as follows:
As the highest priority, the ObjectMapper field annotated with the
@EnableRecordo
annotation will be used, if present.If Spring is being used and the test doesn't have a field, the library will use the ObjectMapper bean from the Spring context if available.
In all cases other than the specific ones where a custom ObjectMapper instance is provided, the library will utilize its default Recordo ObjectMapper instance.
Last updated