diff --git a/lib/src/main/java/io/ably/lib/realtime/ChannelStateListener.java b/lib/src/main/java/io/ably/lib/realtime/ChannelStateListener.java index bf5582d4e..5dbb8ec48 100644 --- a/lib/src/main/java/io/ably/lib/realtime/ChannelStateListener.java +++ b/lib/src/main/java/io/ably/lib/realtime/ChannelStateListener.java @@ -77,7 +77,7 @@ public void onChannelStateChanged(ChannelStateChange stateChange) { for (final ChannelStateListener member : getMembers()) try { member.onChannelStateChanged(stateChange); - } catch(Throwable t) {} + } catch(Throwable ignored) {} } } diff --git a/lib/src/test/java/io/ably/lib/test/realtime/ConnectionManagerTest.java b/lib/src/test/java/io/ably/lib/test/realtime/ConnectionManagerTest.java index 1a9cf7325..292c96049 100644 --- a/lib/src/test/java/io/ably/lib/test/realtime/ConnectionManagerTest.java +++ b/lib/src/test/java/io/ably/lib/test/realtime/ConnectionManagerTest.java @@ -46,6 +46,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -388,7 +389,7 @@ public void onConnectionStateChanged(ConnectionStateChange state) { /* wait for cm thread to exit */ try { Thread.sleep(2000L); - } catch(InterruptedException e) {} + } catch(InterruptedException ignored) {} assertEquals("Verify closed state is reached", ConnectionState.closed, ably.connection.state); Thread.State cmThreadState = threadContainer[0].getState(); @@ -462,7 +463,7 @@ public void run() { connectionWaiter.waitFor(ConnectionState.connected); assertEquals("Verify connected state is reached", ConnectionState.connected, ably.connection.state); - assertTrue("Not expecting token auth", ably.auth.getAuthMethod() == AuthMethod.basic); + assertSame("Not expecting token auth", ably.auth.getAuthMethod(), AuthMethod.basic); ably.close(); connectionWaiter.waitFor(ConnectionState.closed); @@ -471,7 +472,7 @@ public void run() { /* wait for cm thread to exit */ try { Thread.sleep(2000L); - } catch(InterruptedException e) {} + } catch(InterruptedException ignored) {} Thread.State cmThreadState = threadContainer[0].getState(); assertEquals("Verify cm thread has exited", cmThreadState, Thread.State.TERMINATED); @@ -510,7 +511,7 @@ public void run() { /* wait for cm thread to exit */ try { Thread.sleep(2000L); - } catch(InterruptedException e) {} + } catch(InterruptedException ignored) {} Thread.State cmThreadState = threadContainer[0].getState(); assertEquals("Verify cm thread has exited", cmThreadState, Thread.State.TERMINATED); diff --git a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeAuthTest.java b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeAuthTest.java index d50325d0b..d46014e58 100644 --- a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeAuthTest.java +++ b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeAuthTest.java @@ -88,7 +88,7 @@ public void auth_client_match_tokendetails_null_clientId() { assertEquals("Verify connected state is reached", ConnectionState.connected, ablyRealtime.connection.state); /* check expected clientId */ - assertEquals("Auth#clientId is expected to be null", null, ablyRealtime.auth.clientId); + assertNull("Auth#clientId is expected to be null", ablyRealtime.auth.clientId); ablyRealtime.close(); } catch (AblyException e) { diff --git a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeResumeTest.java b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeResumeTest.java index 461388f28..068054528 100644 --- a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeResumeTest.java +++ b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeResumeTest.java @@ -37,8 +37,6 @@ public class RealtimeResumeTest extends ParameterizedTest { - private static final String TAG = RealtimeResumeTest.class.getName(); - @Rule public Timeout testTimeout = Timeout.seconds(60); @@ -1014,7 +1012,6 @@ public void resume_rewind_1 () String testName = "resume_rewind_1"; try { - ClientOptions common_opts = createOptions(testVars.keys[0].keyStr); sender = new AblyRealtime(common_opts); receiver1 = new AblyRealtime(common_opts); @@ -1036,21 +1033,22 @@ public void onRawMessageRecv(ProtocolMessage message) {} }; receiver2 = new AblyRealtime(receiver2_opts); - Channel recever1_channel = receiver1.channels.get("[?rewind=1]" + testName); - Channel recever2_channel = receiver2.channels.get("[?rewind=1]" + testName); - Channel sender_channel = sender.channels.get(testName); + Channel receiver1_channel = receiver1.channels.get("[?rewind=1]" + testName); + Channel receiver2_channel = receiver2.channels.get("[?rewind=1]" + testName); + + Channel sender_channel = sender.channels.get(testName); sender_channel.attach(); (new ChannelWaiter(sender_channel)).waitFor(ChannelState.attached); sender_channel.publish("0", testMessage); /* subscribe 1*/ - MessageWaiter messageWaiter_1 = new MessageWaiter(recever1_channel); + MessageWaiter messageWaiter_1 = new MessageWaiter(receiver1_channel); messageWaiter_1.waitFor(1); assertEquals("Verify rewound message", testMessage, messageWaiter_1.receivedMessages.get(0).data); /* subscribe 2*/ - MessageWaiter messageWaiter_2 = new MessageWaiter(recever2_channel); + MessageWaiter messageWaiter_2 = new MessageWaiter(receiver2_channel); messageWaiter_2.waitFor(1, 7000); assertEquals("Verify no message received on attach_rewind", 0, messageWaiter_2.receivedMessages.size());