Skip to content

Commit 9b1c8a3

Browse files
committed
Fix broken ToStringVisitorTests
Tests were broken due to the switch to Set.of(...) in 2b65f27.
1 parent a69d971 commit 9b1c8a3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -71,7 +71,10 @@ public void predicates() {
7171
testPredicate(pathExtension("foo"), "*.foo");
7272

7373
testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json");
74-
testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]");
74+
75+
ToStringVisitor visitor = new ToStringVisitor();
76+
contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor);
77+
assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain");
7578

7679
testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json");
7780

spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -70,7 +70,10 @@ public void predicates() {
7070
testPredicate(pathExtension("foo"), "*.foo");
7171

7272
testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json");
73-
testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]");
73+
74+
ToStringVisitor visitor = new ToStringVisitor();
75+
contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor);
76+
assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain");
7477

7578
testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json");
7679

0 commit comments

Comments
 (0)