From c93f89d091aeaa71c27cbc3f771ea28c67add1a4 Mon Sep 17 00:00:00 2001 From: sacOO7 Date: Wed, 31 Jan 2024 10:20:37 +0530 Subject: [PATCH] Fixed checkstyle issues for integration tests --- .../java/io/ably/lib/test/common/Helpers.java | 9 ++++++++- .../test/realtime/RealtimeChannelTest.java | 19 +++++++++++++++---- .../realtime/RealtimeConnectFailTest.java | 1 - .../lib/test/realtime/RealtimeResumeTest.java | 5 +---- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/src/test/java/io/ably/lib/test/common/Helpers.java b/lib/src/test/java/io/ably/lib/test/common/Helpers.java index 89a0a1bf7..c3862d1d2 100644 --- a/lib/src/test/java/io/ably/lib/test/common/Helpers.java +++ b/lib/src/test/java/io/ably/lib/test/common/Helpers.java @@ -29,8 +29,15 @@ import io.ably.lib.debug.DebugOptions.RawProtocolListener; import io.ably.lib.http.HttpCore; import io.ably.lib.http.HttpUtils; -import io.ably.lib.realtime.*; +import io.ably.lib.realtime.Channel; import io.ably.lib.realtime.Channel.MessageListener; +import io.ably.lib.realtime.ChannelEvent; +import io.ably.lib.realtime.ChannelState; +import io.ably.lib.realtime.ChannelStateListener; +import io.ably.lib.realtime.CompletionListener; +import io.ably.lib.realtime.Connection; +import io.ably.lib.realtime.ConnectionState; +import io.ably.lib.realtime.ConnectionStateListener; import io.ably.lib.realtime.Presence.PresenceListener; import io.ably.lib.transport.ConnectionManager; import io.ably.lib.types.AblyException; diff --git a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java index 8341acd54..447607571 100644 --- a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java +++ b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java @@ -25,19 +25,30 @@ import io.ably.lib.types.Message; import io.ably.lib.types.ProtocolMessage; import io.ably.lib.util.Log; - -import io.ably.lib.util.StringUtils; import org.hamcrest.Matchers; import org.junit.Ignore; import org.junit.Test; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; public class RealtimeChannelTest extends ParameterizedTest { diff --git a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeConnectFailTest.java b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeConnectFailTest.java index 021d4ec22..02a1d07d5 100644 --- a/lib/src/test/java/io/ably/lib/test/realtime/RealtimeConnectFailTest.java +++ b/lib/src/test/java/io/ably/lib/test/realtime/RealtimeConnectFailTest.java @@ -27,7 +27,6 @@ import org.junit.Test; import org.junit.rules.Timeout; -import java.lang.reflect.Field; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; 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 4e1959874..179106dad 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 @@ -4,9 +4,7 @@ import io.ably.lib.realtime.AblyRealtime; import io.ably.lib.realtime.Channel; import io.ably.lib.realtime.ChannelState; -import io.ably.lib.realtime.ConnectionEvent; import io.ably.lib.realtime.ConnectionState; -import io.ably.lib.realtime.ConnectionStateListener; import io.ably.lib.test.common.Helpers.ChannelWaiter; import io.ably.lib.test.common.Helpers.CompletionSet; import io.ably.lib.test.common.Helpers.ConnectionWaiter; @@ -899,7 +897,7 @@ public void resume_publish_resend_pending_messages_when_resume_failed() throws A static class MutableConnectionManager { ConnectionManager connectionManager; - public MutableConnectionManager(AblyRealtime ablyRealtime) { + MutableConnectionManager(AblyRealtime ablyRealtime) { this.connectionManager = ablyRealtime.connection.connectionManager; } @@ -1045,7 +1043,6 @@ public void resume_publish_reenter_when_resume_failed() throws AblyException { for (int i = 3; i < 9; i++) { assertTrue("Client id isn't there:" + clients[i], sentPresenceMap.containsKey(clients[i])); - senderChannel.presence.enterClient(clients[i],null,presenceCompletion.add()); } } }