Skip to content

Commit

Permalink
refactor: Use instanceof pattern matching (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaczewski authored Sep 30, 2024
1 parent 8e27716 commit 9fbb762
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ private static void setRequestParams(
Method method, Object[] args, MockHttpServletRequestBuilder requestBuilder) {
var queryParams = getRequestParams(method, args);
queryParams.forEach((key, value) -> {
if (value instanceof MockMultipartFile) {
((MockMultipartHttpServletRequestBuilder) requestBuilder).file((MockMultipartFile) value);
if (value instanceof MockMultipartFile multipartFile) {
((MockMultipartHttpServletRequestBuilder) requestBuilder).file(multipartFile);
} else if (value instanceof Collection<?> collection) {
var values = collection.stream().map(Object::toString).toArray(String[]::new);
requestBuilder.param(key, values);
Expand Down

0 comments on commit 9fbb762

Please sign in to comment.