Skip to content

Commit

Permalink
fix toString for empty sentinel stats
Browse files Browse the repository at this point in the history
  • Loading branch information
argha-c committed Apr 27, 2023
1 parent 811ffb0 commit 555f741
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
};
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 555f741

Please sign in to comment.