Skip to content

Commit 90d395e

Browse files
committed
Polishing
1 parent 2e4f5a7 commit 90d395e

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

spring-messaging/src/main/java/org/springframework/messaging/simp/config/MessageBrokerRegistry.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public class MessageBrokerRegistry {
5454
@Nullable
5555
private String userDestinationPrefix;
5656

57-
private boolean preservePublishOrder;
58-
5957
@Nullable
6058
private PathMatcher pathMatcher;
6159

6260
@Nullable
6361
private Integer cacheLimit;
6462

63+
private boolean preservePublishOrder;
64+
6565

6666
public MessageBrokerRegistry(SubscribableChannel clientInboundChannel, MessageChannel clientOutboundChannel) {
6767
Assert.notNull(clientInboundChannel, "Inbound channel must not be null");

spring-messaging/src/test/java/org/springframework/messaging/simp/broker/SimpleBrokerMessageHandlerTests.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import static org.mockito.Mockito.*;
4343

4444
/**
45-
* Unit tests for SimpleBrokerMessageHandler.
45+
* Unit tests for {@link SimpleBrokerMessageHandler}.
4646
*
4747
* @author Rossen Stoyanchev
4848
* @since 4.0
@@ -141,7 +141,6 @@ public void subscribeDisconnectPublish() {
141141

142142
@Test
143143
public void connect() {
144-
145144
String id = "sess1";
146145

147146
Message<String> connectMessage = startSession(id);
@@ -157,9 +156,7 @@ public void connect() {
157156

158157
@Test
159158
public void heartbeatValueWithAndWithoutTaskScheduler() {
160-
161159
assertNull(this.messageHandler.getHeartbeatValue());
162-
163160
this.messageHandler.setTaskScheduler(this.taskScheduler);
164161

165162
assertNotNull(this.messageHandler.getHeartbeatValue());
@@ -175,7 +172,6 @@ public void startWithHeartbeatValueWithoutTaskScheduler() {
175172
@SuppressWarnings("unchecked")
176173
@Test
177174
public void startAndStopWithHeartbeatValue() {
178-
179175
ScheduledFuture future = mock(ScheduledFuture.class);
180176
when(this.taskScheduler.scheduleWithFixedDelay(any(Runnable.class), eq(15000L))).thenReturn(future);
181177

@@ -195,7 +191,6 @@ public void startAndStopWithHeartbeatValue() {
195191
@SuppressWarnings("unchecked")
196192
@Test
197193
public void startWithOneZeroHeartbeatValue() {
198-
199194
this.messageHandler.setTaskScheduler(this.taskScheduler);
200195
this.messageHandler.setHeartbeatValue(new long[] {0, 10000});
201196
this.messageHandler.start();
@@ -205,7 +200,6 @@ public void startWithOneZeroHeartbeatValue() {
205200

206201
@Test
207202
public void readInactivity() throws Exception {
208-
209203
this.messageHandler.setHeartbeatValue(new long[] {0, 1});
210204
this.messageHandler.setTaskScheduler(this.taskScheduler);
211205
this.messageHandler.start();
@@ -237,7 +231,6 @@ public void readInactivity() throws Exception {
237231

238232
@Test
239233
public void writeInactivity() throws Exception {
240-
241234
this.messageHandler.setHeartbeatValue(new long[] {1, 0});
242235
this.messageHandler.setTaskScheduler(this.taskScheduler);
243236
this.messageHandler.start();
@@ -269,7 +262,6 @@ public void writeInactivity() throws Exception {
269262

270263
@Test
271264
public void readWriteIntervalCalculation() throws Exception {
272-
273265
this.messageHandler.setHeartbeatValue(new long[] {1, 1});
274266
this.messageHandler.setTaskScheduler(this.taskScheduler);
275267
this.messageHandler.start();
@@ -294,6 +286,7 @@ public void readWriteIntervalCalculation() throws Exception {
294286
messages.get(0).getHeaders().get(SimpMessageHeaderAccessor.MESSAGE_TYPE_HEADER));
295287
}
296288

289+
297290
private Message<String> startSession(String id) {
298291
this.messageHandler.start();
299292

spring-messaging/src/test/java/org/springframework/messaging/support/ExecutorSubscribableChannelTests.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -65,8 +65,9 @@ public void setup() {
6565
MockitoAnnotations.initMocks(this);
6666
}
6767

68+
6869
@Test
69-
public void messageMustNotBeNull() throws Exception {
70+
public void messageMustNotBeNull() {
7071
thrown.expect(IllegalArgumentException.class);
7172
thrown.expectMessage("Message must not be null");
7273
this.channel.send(null);
@@ -84,7 +85,7 @@ public void sendWithoutExecutor() {
8485
}
8586

8687
@Test
87-
public void sendWithExecutor() throws Exception {
88+
public void sendWithExecutor() {
8889
BeforeHandleInterceptor interceptor = new BeforeHandleInterceptor();
8990
TaskExecutor executor = mock(TaskExecutor.class);
9091
ExecutorSubscribableChannel testChannel = new ExecutorSubscribableChannel(executor);
@@ -100,15 +101,15 @@ public void sendWithExecutor() throws Exception {
100101
}
101102

102103
@Test
103-
public void subscribeTwice() throws Exception {
104+
public void subscribeTwice() {
104105
assertThat(this.channel.subscribe(this.handler), equalTo(true));
105106
assertThat(this.channel.subscribe(this.handler), equalTo(false));
106107
this.channel.send(this.message);
107108
verify(this.handler, times(1)).handleMessage(this.message);
108109
}
109110

110111
@Test
111-
public void unsubscribeTwice() throws Exception {
112+
public void unsubscribeTwice() {
112113
this.channel.subscribe(this.handler);
113114
assertThat(this.channel.unsubscribe(this.handler), equalTo(true));
114115
assertThat(this.channel.unsubscribe(this.handler), equalTo(false));
@@ -117,7 +118,7 @@ public void unsubscribeTwice() throws Exception {
117118
}
118119

119120
@Test
120-
public void failurePropagates() throws Exception {
121+
public void failurePropagates() {
121122
RuntimeException ex = new RuntimeException();
122123
willThrow(ex).given(this.handler).handleMessage(this.message);
123124
MessageHandler secondHandler = mock(MessageHandler.class);
@@ -133,7 +134,7 @@ public void failurePropagates() throws Exception {
133134
}
134135

135136
@Test
136-
public void concurrentModification() throws Exception {
137+
public void concurrentModification() {
137138
this.channel.subscribe(message1 -> channel.unsubscribe(handler));
138139
this.channel.subscribe(this.handler);
139140
this.channel.send(this.message);
@@ -208,8 +209,8 @@ public Message<?> beforeHandle(Message<?> message, MessageChannel channel, Messa
208209
}
209210

210211
@Override
211-
public void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler,
212-
Exception ex) {
212+
public void afterMessageHandled(
213+
Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex) {
213214

214215
this.afterHandledInvoked = true;
215216
}

0 commit comments

Comments
 (0)