From 89f3cc3808054b1ad45582dd73cb2a300cc94097 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Fri, 2 Feb 2018 10:36:29 +0100 Subject: Improve error messages in distro tests Change-Id: Ie0bc2e2add7940cb8f0ce2d5e4ea41d1e1c9d991 Signed-off-by: Marek Gradzki --- .../java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java | 7 ++++--- .../io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java b/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java index d2dc51af5..4053d6222 100644 --- a/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java +++ b/infra/bgp-distribution-test/src/test/java/io/fd/honeycomb/infra/bgp/distro/BgpDistributionTest.java @@ -119,7 +119,7 @@ public class BgpDistributionTest { final byte[] msg = readMessage(inputStream); LOG.info("Received BGP message: {}", msg); - Assert.assertEquals(BGP_OPEN_MSG_TYPE, msg[BGP_MSG_TYPE_OFFSET]); + Assert.assertEquals("BGP OPEN message type was expected", BGP_OPEN_MSG_TYPE, msg[BGP_MSG_TYPE_OFFSET]); } } @@ -131,7 +131,8 @@ public class BgpDistributionTest { } private void assertSuccessStatus(final HttpResponse jsonNodeHttpResponse) { - assertTrue(jsonNodeHttpResponse.getStatus() >= 200); - assertTrue(jsonNodeHttpResponse.getStatus() < 400); + final int statusCode = jsonNodeHttpResponse.getStatus(); + assertTrue("Expected HTTP status code in range [200, 400), but was: " + statusCode, + statusCode >= 200 && statusCode < 400); } } \ No newline at end of file diff --git a/infra/minimal-distribution-test/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java b/infra/minimal-distribution-test/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java index f083903fe..90817802d 100644 --- a/infra/minimal-distribution-test/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java +++ b/infra/minimal-distribution-test/src/test/java/io/fd/honeycomb/infra/distro/BaseMinimalDistributionTest.java @@ -176,7 +176,8 @@ public class BaseMinimalDistributionTest { } private void assertSuccessStatus(final HttpResponse jsonNodeHttpResponse) { - assertTrue(jsonNodeHttpResponse.getStatus() >= 200); - assertTrue(jsonNodeHttpResponse.getStatus() < 400); + final int statusCode = jsonNodeHttpResponse.getStatus(); + assertTrue("Expected HTTP status code in range [200, 400), but was: " + statusCode, + statusCode >= 200 && statusCode < 400); } } \ No newline at end of file -- cgit 1.2.3-korg