|
46 | 46 | import static org.junit.Assert.assertNull; |
47 | 47 | import static org.junit.Assert.assertSame; |
48 | 48 | import static org.junit.Assert.assertThat; |
| 49 | +import static org.junit.Assert.assertThrows; |
49 | 50 | import static org.junit.Assert.assertTrue; |
50 | 51 | import static org.junit.Assert.fail; |
51 | 52 |
|
@@ -2578,6 +2579,29 @@ public void connect_should_not_rewrite_immediate_attach() throws AblyException { |
2578 | 2579 | } |
2579 | 2580 | } |
2580 | 2581 |
|
| 2582 | + @Test |
| 2583 | + public void channel_get_objects_throws_exception() throws AblyException { |
| 2584 | + ClientOptions opts = createOptions(testVars.keys[0].keyStr); |
| 2585 | + try (AblyRealtime ably = new AblyRealtime(opts)) { |
| 2586 | + |
| 2587 | + /* wait until connected */ |
| 2588 | + new ConnectionWaiter(ably.connection).waitFor(ConnectionState.connected); |
| 2589 | + assertEquals("Verify connected state reached", ably.connection.state, ConnectionState.connected); |
| 2590 | + |
| 2591 | + /* create a channel and attach */ |
| 2592 | + final Channel channel = ably.channels.get("channel"); |
| 2593 | + channel.attach(); |
| 2594 | + new ChannelWaiter(channel).waitFor(ChannelState.attached); |
| 2595 | + assertEquals("Verify attached state reached", channel.state, ChannelState.attached); |
| 2596 | + |
| 2597 | + AblyException exception = assertThrows(AblyException.class, channel::getObjects); |
| 2598 | + assertNotNull(exception); |
| 2599 | + assertEquals(40019, exception.errorInfo.code); |
| 2600 | + assertEquals(400, exception.errorInfo.statusCode); |
| 2601 | + assertTrue(exception.errorInfo.message.contains("LiveObjects plugin hasn't been installed")); |
| 2602 | + } |
| 2603 | + } |
| 2604 | + |
2581 | 2605 | static class DetachingProtocolListener implements DebugOptions.RawProtocolListener { |
2582 | 2606 |
|
2583 | 2607 | public Channel theChannel; |
|
0 commit comments