diff --git a/zuul-discovery/src/main/java/com/netflix/zuul/discovery/DiscoveryResult.java b/zuul-discovery/src/main/java/com/netflix/zuul/discovery/DiscoveryResult.java index f99e9d30f8..041288c9a4 100644 --- a/zuul-discovery/src/main/java/com/netflix/zuul/discovery/DiscoveryResult.java +++ b/zuul-discovery/src/main/java/com/netflix/zuul/discovery/DiscoveryResult.java @@ -61,7 +61,12 @@ public DiscoveryResult(DiscoveryEnabledServer server, LoadBalancerStats lbStats) */ public DiscoveryResult(DiscoveryEnabledServer server) { this.server = server; - this.serverStats = new ServerStats(); + this.serverStats = new ServerStats() { + @Override + public String toString() { + return "no stats configured for server"; + } + }; } /** diff --git a/zuul-discovery/src/test/java/com/netflix/zuul/discovery/DiscoveryResultTest.java b/zuul-discovery/src/test/java/com/netflix/zuul/discovery/DiscoveryResultTest.java index af7d06a5f8..ce8afcc835 100644 --- a/zuul-discovery/src/test/java/com/netflix/zuul/discovery/DiscoveryResultTest.java +++ b/zuul-discovery/src/test/java/com/netflix/zuul/discovery/DiscoveryResultTest.java @@ -39,6 +39,11 @@ void hashCodeForNull() { assertEquals(0, discoveryResult.hashCode()); } + @Test + void serverStatsForEmptySentinel() { + Truth.assertThat(DiscoveryResult.EMPTY.getServerStats().toString()).isEqualTo("no stats configured for server"); + } + @Test void hostAndPortForNullServer() { final DiscoveryResult discoveryResult = new DiscoveryResult(null);