Skip to content

Commit eacdbbc

Browse files
committed
Format test class
1 parent 35c073a commit eacdbbc

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/test/java/com/rabbitmq/perf/PublisherOnlyStopsCorrectlyTest.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919
import com.rabbitmq.client.Connection;
2020
import com.rabbitmq.client.ConnectionFactory;
2121
import com.rabbitmq.client.impl.AMQImpl;
22-
import org.hamcrest.Matchers;
23-
import org.hamcrest.junit.MatcherAssert;
2422
import org.junit.jupiter.api.AfterEach;
2523
import org.junit.jupiter.api.BeforeEach;
26-
import org.junit.jupiter.api.Test;
2724
import org.junit.jupiter.params.ParameterizedTest;
2825
import org.junit.jupiter.params.provider.Arguments;
2926
import org.junit.jupiter.params.provider.MethodSource;
@@ -53,34 +50,37 @@ public class PublisherOnlyStopsCorrectlyTest {
5350
MulticastParams params;
5451

5552
Stats stats = new Stats(0) {
53+
5654
@Override
5755
protected void report(long now) {
5856
}
5957
};
6058

6159
ExecutorService executorService;
6260

63-
@BeforeEach public void init() {
61+
static Stream<Arguments> publisherOnlyStopsWhenBrokerCrashesArguments() {
62+
return Stream.of(
63+
// number of messages before throwing exception, configurator, assertion message
64+
Arguments.of(10, (Consumer<MulticastParams>) (params) -> { }, "Sender should have failed and program should stop"),
65+
Arguments.of(2, (Consumer<MulticastParams>) (params) -> params.setPublishingInterval(1), "Sender should have failed and program should stop")
66+
);
67+
}
68+
69+
@BeforeEach
70+
public void init() {
6471
params = new MulticastParams();
6572
executorService = Executors.newSingleThreadExecutor();
6673
}
6774

68-
@AfterEach public void tearDown() {
75+
@AfterEach
76+
public void tearDown() {
6977
executorService.shutdownNow();
7078
}
7179

72-
static Stream<Arguments> publisherOnlyStopsWhenBrokerCrashesArguments() {
73-
return Stream.of(
74-
// number of messages before throwing exception, configurator, assertion message
75-
Arguments.of(10, (Consumer<MulticastParams>)(params) -> {}, "Sender should have failed and program should stop"),
76-
Arguments.of(2, (Consumer<MulticastParams>)(params) -> params.setPublishingInterval(1), "Sender should have failed and program should stop")
77-
);
78-
}
79-
8080
@ParameterizedTest
8181
@MethodSource("publisherOnlyStopsWhenBrokerCrashesArguments")
8282
public void publisherOnlyStopsWhenBrokerCrashes(
83-
int messageTotal, Consumer<MulticastParams> configurator, String message) throws Exception {
83+
int messageTotal, Consumer<MulticastParams> configurator, String message) throws Exception {
8484
params.setConsumerCount(0);
8585
params.setProducerCount(1);
8686
configurator.accept(params);
@@ -112,7 +112,6 @@ public void publisherOnlyStopsWhenBrokerCrashes(
112112
return null;
113113
});
114114
assertThat(message, latch.await(10, TimeUnit.SECONDS), is(true));
115-
116115
}
117116

118117
private MulticastSet getMulticastSet(ConnectionFactory connectionFactory) {
@@ -123,5 +122,4 @@ stats, connectionFactory, params, singletonList("amqp://localhost"),
123122
set.setThreadingHandler(new MulticastSet.DefaultThreadingHandler());
124123
return set;
125124
}
126-
127125
}

0 commit comments

Comments
 (0)