|
22 | 22 | import java.util.Set; |
23 | 23 | import java.util.concurrent.ScheduledThreadPoolExecutor; |
24 | 24 |
|
| 25 | +import org.hamcrest.Description; |
| 26 | +import org.hamcrest.Matcher; |
| 27 | +import org.hamcrest.Matchers; |
| 28 | +import org.hamcrest.TypeSafeMatcher; |
25 | 29 | import org.junit.Before; |
26 | 30 | import org.junit.Test; |
27 | 31 |
|
@@ -138,14 +142,16 @@ public void messageBrokerSockJsTaskScheduler() { |
138 | 142 | public void webSocketMessageBrokerStats() { |
139 | 143 | String name = "webSocketMessageBrokerStats"; |
140 | 144 | WebSocketMessageBrokerStats stats = this.config.getBean(name, WebSocketMessageBrokerStats.class); |
141 | | - assertEquals("WebSocketSession[0 current WS(0)-HttpStream(0)-HttpPoll(0), " + |
142 | | - "0 total, 0 closed abnormally (0 connect failure, 0 send limit, 0 transport error)], " + |
143 | | - "stompSubProtocol[processed CONNECT(0)-CONNECTED(0)-DISCONNECT(0)], " + |
144 | | - "stompBrokerRelay[null], " + |
145 | | - "inboundChannel[pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " + |
146 | | - "outboundChannelpool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0], " + |
147 | | - "sockJsScheduler[pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 0]", |
148 | | - stats.toString()); |
| 145 | + String actual = stats.toString(); |
| 146 | + String expected = "WebSocketSession\\[0 current WS\\(0\\)-HttpStream\\(0\\)-HttpPoll\\(0\\), " + |
| 147 | + "0 total, 0 closed abnormally \\(0 connect failure, 0 send limit, 0 transport error\\)\\], " + |
| 148 | + "stompSubProtocol\\[processed CONNECT\\(0\\)-CONNECTED\\(0\\)-DISCONNECT\\(0\\)\\], " + |
| 149 | + "stompBrokerRelay\\[null\\], " + |
| 150 | + "inboundChannel\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + |
| 151 | + "outboundChannelpool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\], " + |
| 152 | + "sockJsScheduler\\[pool size = \\d, active threads = \\d, queued tasks = \\d, completed tasks = \\d\\]"; |
| 153 | + |
| 154 | + assertTrue("\nExpected: " + expected.replace("\\", "") + "\n Actual: " + actual, actual.matches(expected)); |
149 | 155 | } |
150 | 156 |
|
151 | 157 |
|
|
0 commit comments