Common DataWithMediaType class and common synchronization for ResponseBodyEmitter/SseEmitter
Issue: SPR-13223 Issue: SPR-13224
This commit is contained in:
@@ -31,7 +31,9 @@ import static org.junit.Assert.fail;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ResponseBodyEmitter}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Tomasz Nurkiewicz
|
||||
*/
|
||||
public class ResponseBodyEmitterTests {
|
||||
|
||||
@@ -62,6 +64,19 @@ public class ResponseBodyEmitterTests {
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sendDuplicateBeforeHandlerInitialized() throws Exception {
|
||||
this.emitter.send("foo", MediaType.TEXT_PLAIN);
|
||||
this.emitter.send("foo", MediaType.TEXT_PLAIN);
|
||||
this.emitter.complete();
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
|
||||
this.emitter.initialize(this.handler);
|
||||
verify(this.handler, times(2)).send("foo", MediaType.TEXT_PLAIN);
|
||||
verify(this.handler).complete();
|
||||
verifyNoMoreInteractions(this.handler);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sendBeforeHandlerInitializedWithError() throws Exception {
|
||||
IllegalStateException ex = new IllegalStateException();
|
||||
|
||||
Reference in New Issue
Block a user