Skip to content

Commit 8d48be7

Browse files
committed
[ECO-5553] Fixed omitted tests responsible for handling vcdiff encoding
1 parent 993b308 commit 8d48be7

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public void attach_detach() {
150150
}
151151
}
152152

153-
/*@Test*/
153+
@Test
154154
public void attach_with_channel_params_channels_get() {
155155
String channelName = "attach_with_channel_params_channels_get_" + testParams.name;
156156
AblyRealtime ably = null;
@@ -163,7 +163,7 @@ public void attach_with_channel_params_channels_get() {
163163
assertEquals("Verify connected state reached", ConnectionState.connected, ably.connection.state);
164164

165165
ChannelOptions options = new ChannelOptions();
166-
options.params = new HashMap<String, String>();
166+
options.params = new HashMap<>();
167167
options.params.put("modes", "subscribe");
168168
options.params.put("delta", "vcdiff");
169169

@@ -183,7 +183,7 @@ public void attach_with_channel_params_channels_get() {
183183
}
184184
}
185185

186-
/*@Test*/
186+
@Test
187187
public void attach_with_channel_params_set_options() {
188188
String channelName = "attach_with_channel_params_set_options_" + testParams.name;
189189
AblyRealtime ably = null;
@@ -196,6 +196,7 @@ public void attach_with_channel_params_set_options() {
196196
assertEquals("Verify connected state reached", ConnectionState.connected, ably.connection.state);
197197

198198
ChannelOptions options = new ChannelOptions();
199+
options.params = new HashMap<>();
199200
options.params.put("modes", "subscribe");
200201
options.params.put("delta", "vcdiff");
201202

@@ -216,7 +217,7 @@ public void attach_with_channel_params_set_options() {
216217
}
217218
}
218219

219-
/*@Test*/
220+
@Test
220221
public void channels_get_should_throw_when_would_cause_reattach() {
221222
String channelName = "channels_get_should_throw_when_would_cause_reattach_" + testParams.name;
222223
AblyRealtime ably = null;
@@ -228,22 +229,25 @@ public void channels_get_should_throw_when_would_cause_reattach() {
228229
(new ConnectionWaiter(ably.connection)).waitFor(ConnectionState.connected);
229230
assertEquals("Verify connected state reached", ConnectionState.connected, ably.connection.state);
230231

231-
ChannelOptions options = new ChannelOptions();
232-
options.params.put("modes", "subscribe");
233-
options.params.put("delta", "vcdiff");
232+
ChannelOptions options = new ChannelOptions() {{
233+
params = new HashMap<>();
234+
params.put("modes", "subscribe");
235+
params.put("delta", "vcdiff");
236+
}};
234237

235238
/* create a channel and attach */
236239
final Channel channel = ably.channels.get(channelName, options);
237240
channel.attach();
238241
(new ChannelWaiter(channel)).waitFor(ChannelState.attached);
239242

240-
try {
241-
ably.channels.get(channelName, options);
242-
} catch (AblyException e) {
243-
assertEquals("Verify error code", 400, e.errorInfo.code);
244-
assertEquals("Verify error status code", 40000, e.errorInfo.statusCode);
245-
assertTrue("Verify error message", e.errorInfo.message.contains("setOptions"));
246-
}
243+
AblyRealtime finalAbly = ably;
244+
AblyException exception = assertThrows(AblyException.class, () ->
245+
finalAbly.channels.get(channelName, options));
246+
247+
assertEquals("Verify error code", 400, exception.errorInfo.code);
248+
assertEquals("Verify error status code", 40000, exception.errorInfo.statusCode);
249+
assertTrue("Verify error message", exception.errorInfo.message.contains("use Channel.setOptions()"));
250+
247251
} catch (AblyException e) {
248252
e.printStackTrace();
249253
fail("init0: Unexpected exception instantiating library");

0 commit comments

Comments
 (0)