From 373b90d26319d0e741b940de9bec1d22fa7983b8 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 13 Oct 2021 20:43:13 +0200 Subject: [PATCH] Simplify JsonPathExpectationsHelperTests with text blocks --- .../util/JsonPathExpectationsHelperTests.java | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/spring-test/src/test/java/org/springframework/test/util/JsonPathExpectationsHelperTests.java b/spring-test/src/test/java/org/springframework/test/util/JsonPathExpectationsHelperTests.java index 177e1da909c..1f8145cbc03 100644 --- a/spring-test/src/test/java/org/springframework/test/util/JsonPathExpectationsHelperTests.java +++ b/spring-test/src/test/java/org/springframework/test/util/JsonPathExpectationsHelperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 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. @@ -30,25 +30,29 @@ import static org.hamcrest.core.Is.is; */ class JsonPathExpectationsHelperTests { - private static final String CONTENT = "{" + // - "'str': 'foo', " + // - "'num': 5, " + // - "'bool': true, " + // - "'arr': [42], " + // - "'colorMap': {'red': 'rojo'}, " + // - "'whitespace': ' ', " + // - "'emptyString': '', " + // - "'emptyArray': [], " + // - "'emptyMap': {} " + // - "}"; - - private static final String SIMPSONS = "{ 'familyMembers': [ " + // - "{'name': 'Homer' }, " + // - "{'name': 'Marge' }, " + // - "{'name': 'Bart' }, " + // - "{'name': 'Lisa' }, " + // - "{'name': 'Maggie'} " + // - " ] }"; + private static final String CONTENT = """ + { + 'str': 'foo', + 'num': 5, + 'bool': true, + 'arr': [42], + 'colorMap': {'red': 'rojo'}, + 'whitespace': ' ', + 'emptyString': '', + 'emptyArray': [], + 'emptyMap': {} + }"""; + + private static final String SIMPSONS = """ + { + 'familyMembers': [ + {'name': 'Homer' }, + {'name': 'Marge' }, + {'name': 'Bart' }, + {'name': 'Lisa' }, + {'name': 'Maggie'} + ] + }"""; @Test