From 417910724c925d97081cd4249322f41541fd707c Mon Sep 17 00:00:00 2001 From: Carolin Brandt Date: Thu, 16 Jun 2022 11:55:38 +0200 Subject: [PATCH] Add test for ConsulResponse.toString --- src/test/java/com/orbitz/consul/util/HttpTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/java/com/orbitz/consul/util/HttpTest.java b/src/test/java/com/orbitz/consul/util/HttpTest.java index 453f7fc9..70a49aa7 100644 --- a/src/test/java/com/orbitz/consul/util/HttpTest.java +++ b/src/test/java/com/orbitz/consul/util/HttpTest.java @@ -319,4 +319,13 @@ public void consulResponseShouldHaveKnownLeaderIfPresentInHeader() { assertEquals(true, consulResponse.isKnownLeader()); } + + @Test + public void testToString() { + String responseMessage = "success"; + ConsulResponse expectedConsulResponse = new ConsulResponse<>(responseMessage, 0, false, BigInteger.ZERO, null, null); + Response response = Response.success(responseMessage); + ConsulResponse consulResponse = Http.consulResponse(response); + assertEquals("ConsulResponse{response=success, lastContact=0, knownLeader=false, index=0, cache=Optional.empty}", consulResponse.toString()); + } }