@@ -174,7 +174,7 @@ public void attach_with_channel_params_channels_get() {
174174 channel .attach ();
175175 (new ChannelWaiter (channel )).waitFor (ChannelState .attached );
176176 assertEquals ("Verify attached state reached" , ChannelState .attached , channel .state );
177- assertEquals ("Verify channel params" , channel .getParams (), options . params );
177+ assertEquals ("Verify channel params" , options . params , channel .getParams ());
178178 assertArrayEquals ("Verify channel modes" , new ChannelMode [] { ChannelMode .subscribe }, channel .getModes ());
179179 } catch (AblyException e ) {
180180 e .printStackTrace ();
@@ -208,7 +208,7 @@ public void attach_with_channel_params_set_options() {
208208 channel .attach ();
209209 (new ChannelWaiter (channel )).waitFor (ChannelState .attached );
210210 assertEquals ("Verify attached state reached" , ChannelState .attached , channel .state );
211- assertEquals ("Verify channel params" , channel .getParams (), options . params );
211+ assertEquals ("Verify channel params" , options . params , channel .getParams ());
212212 assertArrayEquals ("Verify channel modes" , new ChannelMode [] { ChannelMode .subscribe }, channel .getModes ());
213213 } catch (AblyException e ) {
214214 e .printStackTrace ();
@@ -285,7 +285,10 @@ public void attach_with_channel_params_modes_and_channel_modes() {
285285 (new ChannelWaiter (channel )).waitFor (ChannelState .attached );
286286 assertEquals ("Verify attached state reached" , ChannelState .attached , channel .state );
287287 assertEquals ("Verify channel params" , channel .getParams (), options .params );
288- assertArrayEquals ("Verify channel modes" , new ChannelMode [] { ChannelMode .subscribe , ChannelMode .presence }, channel .getModes ());
288+ // modes in params overrides individual modes in options
289+ assertThat ("Verify channel modes" , Arrays .asList (channel .getModes ()),
290+ Matchers .containsInAnyOrder (ChannelMode .presence , ChannelMode .subscribe ));
291+
289292 } catch (AblyException e ) {
290293 e .printStackTrace ();
291294 fail ("init0: Unexpected exception instantiating library" );
0 commit comments