Skip to content

Commit c6e3303

Browse files
committed
[ECO-5056] Added test for getObjects when liveobjects plugin is not installed
1 parent cd9490b commit c6e3303

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import static org.junit.Assert.assertNull;
4747
import static org.junit.Assert.assertSame;
4848
import static org.junit.Assert.assertThat;
49+
import static org.junit.Assert.assertThrows;
4950
import static org.junit.Assert.assertTrue;
5051
import static org.junit.Assert.fail;
5152

@@ -2578,6 +2579,29 @@ public void connect_should_not_rewrite_immediate_attach() throws AblyException {
25782579
}
25792580
}
25802581

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+
25812605
static class DetachingProtocolListener implements DebugOptions.RawProtocolListener {
25822606

25832607
public Channel theChannel;

0 commit comments

Comments
 (0)