diff --git a/pom.xml b/pom.xml
index a4d7fa0..60b7160 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
it.aboutbits
spring-boot-testing
- 2.2.0
+ 2.3.0
Testing library for Spring Boot projects.
@@ -25,7 +25,7 @@
it.aboutbits
spring-boot-toolbox
- 2.4.1
+ 2.4.4
it.aboutbits
diff --git a/readme.md b/readme.md
index 580237d..7b0d97f 100644
--- a/readme.md
+++ b/readme.md
@@ -109,7 +109,7 @@ void testValidation() {
}
```
-Alternatively you can use a method call to a service function to verify the validation. This is the preferred way as it makes sure that the bean validation is both triggered and also valid.
+Alternatively, you can use a method call to a service function to verify the validation. This is the preferred way as it makes sure that the bean validation is both triggered and also valid.
```java
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/src/main/java/it/aboutbits/springboot/testing/web/request/HttpTestSecurity.java b/src/main/java/it/aboutbits/springboot/testing/web/request/HttpTestSecurity.java
index 3712bf3..790ec9a 100644
--- a/src/main/java/it/aboutbits/springboot/testing/web/request/HttpTestSecurity.java
+++ b/src/main/java/it/aboutbits/springboot/testing/web/request/HttpTestSecurity.java
@@ -170,6 +170,7 @@ public void assertDeleteGranted(String url, Object... pathVariables) {
assertThatRequest(result).wasGranted();
}
+ @SuppressWarnings("unused")
public void assertDeleteDenied(String url, Object... pathVariables) {
var result = httpTestClient.delete(url, pathVariables)
.body("{}")
diff --git a/src/main/java/it/aboutbits/springboot/testing/web/request/Request.java b/src/main/java/it/aboutbits/springboot/testing/web/request/Request.java
index ef6f69a..c5e60e4 100644
--- a/src/main/java/it/aboutbits/springboot/testing/web/request/Request.java
+++ b/src/main/java/it/aboutbits/springboot/testing/web/request/Request.java
@@ -193,6 +193,21 @@ public PagedResponse returnPage(Class clazz) {
}
}
+ @SneakyThrows(UnsupportedEncodingException.class)
+ @SuppressWarnings("unused")
+ public T returnCustom(Class clazz) {
+ var res = _execute();
+
+ var resString = res.andReturn().getResponse().getContentAsString(StandardCharsets.UTF_8);
+
+ try {
+ return jsonMapper.readValue(resString, clazz);
+ } catch (JacksonException e) {
+ log.error("Failed to read response as JSON.", e);
+ throw new ResponseBodyException(e);
+ }
+ }
+
@SneakyThrows(UnsupportedEncodingException.class)
@SuppressWarnings("unused")
public ErrorResponse returnError() {