Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>it.aboutbits</groupId>
<artifactId>spring-boot-testing</artifactId>
<version>2.2.0</version>
<version>2.3.0</version>
<description>Testing library for Spring Boot projects.</description>

<properties>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>it.aboutbits</groupId>
<artifactId>spring-boot-toolbox</artifactId>
<version>2.4.1</version>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>it.aboutbits</groupId>
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("{}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,21 @@ public <T> PagedResponse<T> returnPage(Class<T> clazz) {
}
}

@SneakyThrows(UnsupportedEncodingException.class)
@SuppressWarnings("unused")
public <T> T returnCustom(Class<T> 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() {
Expand Down