Skip to content

Commit cc16b64

Browse files
committed
fix(datashare-tasks): fix flaky AmqpTest
1 parent e1d00c0 commit cc16b64

File tree

1 file changed

+7
-7
lines changed
  • datashare-tasks/src/test/java/org/icij/datashare/asynctasks/bus/amqp

1 file changed

+7
-7
lines changed

datashare-tasks/src/test/java/org/icij/datashare/asynctasks/bus/amqp/AmqpTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import java.util.Optional;
66
import org.icij.datashare.asynctasks.NackException;
77
import org.icij.datashare.json.JsonObjectMapper;
8-
import org.junit.After;
98
import org.junit.AfterClass;
9+
import org.junit.Before;
1010
import org.junit.BeforeClass;
1111
import org.junit.ClassRule;
1212
import org.junit.Ignore;
@@ -33,11 +33,16 @@ public class AmqpTest {
3333
static private AmqpInterlocutor amqp;
3434

3535
@BeforeClass
36-
public static void setUp() throws Exception {
36+
public static void setUpClass() throws Exception {
3737
AmqpQueue[] queues = {AmqpQueue.EVENT, AmqpQueue.MANAGER_EVENT};
3838
amqp = new AmqpInterlocutor(new Configuration(new URI("amqp://admin:admin@localhost:12345?nbMessageMax=10&rabbitMq=false")), queues);
3939
}
4040

41+
@Before
42+
public void setUp() throws Exception {
43+
eventQueue.clear();
44+
}
45+
4146
@Test
4247
public void test_publish_receive() throws Exception {
4348
AmqpConsumer<TestEvent, TestEventConsumer> consumer = new AmqpConsumer<>(amqp, new TestEventConsumer(), AmqpQueue.EVENT, TestEvent.class);
@@ -172,11 +177,6 @@ public void test_routing_with_suffix() throws Exception {
172177
consumer.cancel();
173178
}
174179

175-
@After
176-
public void tearDown() throws Exception {
177-
eventQueue.clear();
178-
}
179-
180180
@AfterClass
181181
public static void afterClass() throws Exception {
182182
amqp.close();

0 commit comments

Comments
 (0)