From 9b1c8a3a5cd72a1a5301c6966d124783f7e17ffb Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 7 May 2022 16:45:46 +0200 Subject: [PATCH] Fix broken ToStringVisitorTests Tests were broken due to the switch to Set.of(...) in 2b65f274dc77645d4af6ca76a62008b6cede2675. --- .../web/reactive/function/server/ToStringVisitorTests.java | 7 +++++-- .../web/servlet/function/ToStringVisitorTests.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java index 1f92356a97..ded97be8e4 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/function/server/ToStringVisitorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,10 @@ public class ToStringVisitorTests { testPredicate(pathExtension("foo"), "*.foo"); testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json"); - testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]"); + + ToStringVisitor visitor = new ToStringVisitor(); + contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor); + assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain"); testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java index 045415ec9c..eaba8b842a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/function/ToStringVisitorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,7 +70,10 @@ public class ToStringVisitorTests { testPredicate(pathExtension("foo"), "*.foo"); testPredicate(contentType(MediaType.APPLICATION_JSON), "Content-Type: application/json"); - testPredicate(contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN), "Content-Type: [application/json, text/plain]"); + + ToStringVisitor visitor = new ToStringVisitor(); + contentType(MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN).accept(visitor); + assertThat(visitor.toString()).matches("Content-Type: \\[.+, .+\\]").contains("application/json", "text/plain"); testPredicate(accept(MediaType.APPLICATION_JSON), "Accept: application/json");