|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2015 the original author or authors. |
| 2 | + * Copyright 2002-2016 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
16 | 16 |
|
17 | 17 | package org.springframework.messaging.simp.broker;
|
18 | 18 |
|
19 |
| -import static org.junit.Assert.*; |
20 |
| -import static org.mockito.Mockito.*; |
21 |
| - |
22 | 19 | import java.security.Principal;
|
23 | 20 | import java.util.Collections;
|
24 | 21 | import java.util.List;
|
|
41 | 38 | import org.springframework.messaging.support.MessageBuilder;
|
42 | 39 | import org.springframework.scheduling.TaskScheduler;
|
43 | 40 |
|
| 41 | +import static org.junit.Assert.assertArrayEquals; |
| 42 | +import static org.junit.Assert.assertEquals; |
| 43 | +import static org.junit.Assert.assertNotNull; |
| 44 | +import static org.junit.Assert.assertNull; |
| 45 | +import static org.junit.Assert.assertSame; |
| 46 | +import static org.junit.Assert.assertTrue; |
| 47 | +import static org.mockito.Mockito.any; |
| 48 | +import static org.mockito.Mockito.atLeast; |
| 49 | +import static org.mockito.Mockito.eq; |
| 50 | +import static org.mockito.Mockito.mock; |
| 51 | +import static org.mockito.Mockito.times; |
| 52 | +import static org.mockito.Mockito.verify; |
| 53 | +import static org.mockito.Mockito.verifyNoMoreInteractions; |
| 54 | +import static org.mockito.Mockito.when; |
| 55 | + |
44 | 56 | /**
|
45 | 57 | * Unit tests for SimpleBrokerMessageHandler.
|
46 | 58 | *
|
@@ -72,7 +84,7 @@ public class SimpleBrokerMessageHandlerTests {
|
72 | 84 | public void setup() {
|
73 | 85 | MockitoAnnotations.initMocks(this);
|
74 | 86 | this.messageHandler = new SimpleBrokerMessageHandler(this.clientInboundChannel,
|
75 |
| - this.clientOutboundChannel, this.brokerChannel, Collections.<String>emptyList()); |
| 87 | + this.clientOutboundChannel, this.brokerChannel, Collections.emptyList()); |
76 | 88 | }
|
77 | 89 |
|
78 | 90 |
|
@@ -130,6 +142,7 @@ public void subcribeDisconnectPublish() {
|
130 | 142 |
|
131 | 143 | Message<?> captured = this.messageCaptor.getAllValues().get(0);
|
132 | 144 | assertEquals(SimpMessageType.DISCONNECT_ACK, SimpMessageHeaderAccessor.getMessageType(captured.getHeaders()));
|
| 145 | + assertSame(message, captured.getHeaders().get(SimpMessageHeaderAccessor.DISCONNECT_MESSAGE_HEADER)); |
133 | 146 | assertEquals(sess1, SimpMessageHeaderAccessor.getSessionId(captured.getHeaders()));
|
134 | 147 | assertEquals("joe", SimpMessageHeaderAccessor.getUser(captured.getHeaders()).getName());
|
135 | 148 |
|
|
0 commit comments