From 6e556a5088623f7af658441f0fc1571023910174 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Thu, 18 Mar 2021 17:09:07 -0400 Subject: [PATCH] put test output in variable --- .../util/random/CachedRandomPropertySourceTests.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-cloud-context/src/test/java/org/springframework/cloud/util/random/CachedRandomPropertySourceTests.java b/spring-cloud-context/src/test/java/org/springframework/cloud/util/random/CachedRandomPropertySourceTests.java index fdd6f945..bf92318b 100644 --- a/spring-cloud-context/src/test/java/org/springframework/cloud/util/random/CachedRandomPropertySourceTests.java +++ b/spring-cloud-context/src/test/java/org/springframework/cloud/util/random/CachedRandomPropertySourceTests.java @@ -66,12 +66,12 @@ public class CachedRandomPropertySourceTests { then(cachedRandomPropertySource.getProperty("cachedrandom.app.long")).isEqualTo(1234L); then(cachedRandomPropertySource.getProperty("cachedrandom.foo.long")).isEqualTo(5678L); - System.err.println(output); - then(StringUtils.countOccurrencesOf(output.toString(), "No cached value found for key: app")).isEqualTo(1); - then(StringUtils.countOccurrencesOf(output.toString(), + String str = output.toString(); + then(StringUtils.countOccurrencesOf(str, "No cached value found for key: app")).isEqualTo(1); + then(StringUtils.countOccurrencesOf(str, "No random value found in cache for key: app and type: long, generating a new value")).isEqualTo(1); - then(StringUtils.countOccurrencesOf(output.toString(), "No cached value found for key: foo")).isEqualTo(0); - then(StringUtils.countOccurrencesOf(output.toString(), + then(StringUtils.countOccurrencesOf(str, "No cached value found for key: foo")).isEqualTo(0); + then(StringUtils.countOccurrencesOf(str, "No random value found in cache for key: foot and type: long, generating a new value")).isEqualTo(0); }