From 1608d33351200c038d6a11a9aca3ccfa6c7313c4 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 18 Feb 2016 20:43:59 +0100 Subject: [PATCH] Improve test stability --- src/test/java/biz/paluch/spinach/ClientTest.java | 2 +- .../java/biz/paluch/spinach/impl/DisqueCommandTest.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/test/java/biz/paluch/spinach/ClientTest.java b/src/test/java/biz/paluch/spinach/ClientTest.java index b989d22..6fcd666 100644 --- a/src/test/java/biz/paluch/spinach/ClientTest.java +++ b/src/test/java/biz/paluch/spinach/ClientTest.java @@ -180,7 +180,7 @@ public void connectConnectionRefused() throws Exception { client.connect(); } catch (Exception e) { assertThat(e).hasRootCauseExactlyInstanceOf(ConnectException.class); - assertThat(e.getCause().getCause()).hasMessageContaining("Connection refused"); + assertThat(e.getCause().getCause()).hasMessageContaining(TestSettings.host()); } client.shutdown(0, 0, TimeUnit.MILLISECONDS); } diff --git a/src/test/java/biz/paluch/spinach/impl/DisqueCommandTest.java b/src/test/java/biz/paluch/spinach/impl/DisqueCommandTest.java index eb66189..070bf4e 100644 --- a/src/test/java/biz/paluch/spinach/impl/DisqueCommandTest.java +++ b/src/test/java/biz/paluch/spinach/impl/DisqueCommandTest.java @@ -1,12 +1,13 @@ package biz.paluch.spinach.impl; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import java.nio.ByteBuffer; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import org.junit.After; import org.junit.Test; import biz.paluch.spinach.api.CommandKeyword; @@ -23,6 +24,12 @@ public class DisqueCommandTest { private DisqueCommand sut = new DisqueCommand(CommandKeyword.GET, new StatusOutput(null), new DisqueCommandArgs(null)); + @After + public void tearDown() throws Exception { + // clear interrupted flag + Thread.interrupted(); + } + @Test public void sucessfulGet() throws Exception {