From bd7f0db3c76ddc86c07cd8b7b1aea03d653d3476 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Tue, 20 May 2025 12:21:16 -0400 Subject: [PATCH] Migrate Hazelcast module from JUnit 4 --- ...stIntegrationDefinitionValidatorTests.java | 72 ++++---- ...tributedMapInboundChannelAdapterTests.java | 11 +- ...itorInboundChannelAdapterTests-context.xml | 170 ------------------ ...sterMonitorInboundChannelAdapterTests.java | 111 ------------ ...EventDrivenInboundChannelAdapterTests.java | 19 +- ...EventDrivenInboundChannelAdapterTests.java | 13 +- ...EventDrivenInboundChannelAdapterTests.java | 19 +- ...tributedSQLInboundChannelAdapterTests.java | 13 +- ...EventDrivenInboundChannelAdapterTests.java | 19 +- ...EventDrivenInboundChannelAdapterTests.java | 13 +- ...EventDrivenInboundChannelAdapterTests.java | 12 +- ...EventDrivenInboundChannelAdapterTests.java | 13 +- ...edMapInboundChannelAdapterConfigTests.java | 13 +- ...nitorInboundChannelAdapterConfigTests.java | 13 +- ...edSQLInboundChannelAdapterConfigTests.java | 13 +- ...rivenInboundChannelAdapterConfigTests.java | 13 +- 16 files changed, 124 insertions(+), 413 deletions(-) delete mode 100644 spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests-context.xml delete mode 100644 spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidatorTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidatorTests.java index a8bf3be7d6..2f227e5216 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidatorTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,16 +22,15 @@ import java.util.Set; import com.hazelcast.collection.IList; import com.hazelcast.core.DistributedObject; import com.hazelcast.instance.impl.HazelcastInstanceFactory; -import org.junit.AfterClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; /** * Hazelcast Integration Definition Validator Test Class @@ -41,8 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"rawtypes"}) public class HazelcastIntegrationDefinitionValidatorTests { @@ -50,7 +48,7 @@ public class HazelcastIntegrationDefinitionValidatorTests { @Autowired private IList distList; - @AfterClass + @AfterAll public static void shutdown() { HazelcastInstanceFactory.terminateAll(); } @@ -67,11 +65,11 @@ public class HazelcastIntegrationDefinitionValidatorTests { } } - @Test(expected = IllegalArgumentException.class) + @Test public void testValidateEnumTypeWithInvalidValue() { - final String cacheEventTypes = "Invalid_Enum_Type"; - HazelcastIntegrationDefinitionValidator - .validateEnumType(CacheEventType.class, cacheEventTypes); + assertThatIllegalArgumentException() + .isThrownBy(() -> HazelcastIntegrationDefinitionValidator + .validateEnumType(CacheEventType.class, "Invalid_Enum_Type")); } @Test @@ -83,12 +81,13 @@ public class HazelcastIntegrationDefinitionValidatorTests { .validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet); } - @Test(expected = IllegalArgumentException.class) + @Test public void testValidateCacheEventsByDistributedObjectWithInvalidValue() { Set cacheEventTypeSet = new HashSet<>(1); cacheEventTypeSet.add("Invalid_Cache_Event_Type"); - HazelcastIntegrationDefinitionValidator - .validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet); + assertThatIllegalArgumentException() + .isThrownBy(() -> HazelcastIntegrationDefinitionValidator + .validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet)); } @Test @@ -97,32 +96,35 @@ public class HazelcastIntegrationDefinitionValidatorTests { .validateCacheTypeForEventDrivenMessageProducer(this.distList); } - @Test(expected = IllegalArgumentException.class) + @Test public void testValidateCacheTypeForEventDrivenMessageProducerWithUnexpectedDistObject() { - HazelcastIntegrationDefinitionValidator - .validateCacheTypeForEventDrivenMessageProducer(new DistributedObject() { + DistributedObject distributedObject = new DistributedObject() { - @Override - public String getPartitionKey() { - return null; - } + @Override + public String getPartitionKey() { + return null; + } - @Override - public String getName() { - return null; - } + @Override + public String getName() { + return null; + } - @Override - public String getServiceName() { - return null; - } + @Override + public String getServiceName() { + return null; + } - @Override - public void destroy() { + @Override + public void destroy() { - } + } - }); + }; + + assertThatIllegalArgumentException() + .isThrownBy(() -> HazelcastIntegrationDefinitionValidator + .validateCacheTypeForEventDrivenMessageProducer(distributedObject)); } } diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java index 71e5cda58b..182af4e571 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.core.EntryEventType; import com.hazelcast.map.IMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -40,8 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat; * @author Eren Avsarogullari * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastCQDistributedMapInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests-context.xml b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests-context.xml deleted file mode 100644 index 8494afe00b..0000000000 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests-context.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java deleted file mode 100644 index 5171660137..0000000000 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright 2015-2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.integration.hazelcast.inbound; - -import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.LifecycleEvent; -import com.hazelcast.core.LifecycleEvent.LifecycleState; -import com.hazelcast.instance.impl.HazelcastInstanceFactory; -import org.junit.AfterClass; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; -import org.springframework.messaging.Message; -import org.springframework.messaging.PollableChannel; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Hazelcast Cluster Monitor Inbound Channel Adapter Unit Test Class - * - * @author Eren Avsarogullari - * @author Artem Bilan - */ -@RunWith(SpringRunner.class) -@SpringJUnitConfig -@DirtiesContext -@Ignore("Hard to reach CP consensus with limited number of members in two clusters") -public class HazelcastClusterMonitorInboundChannelAdapterTests { - - private static final String TEST_GROUP_NAME1 = "Test_Group_Name1"; - - @Autowired - private PollableChannel cmChannel1; - - @Autowired - private PollableChannel cmChannel2; - - @Autowired - private PollableChannel cmChannel3; - - @Autowired - private PollableChannel cmChannel4; - - @Autowired - private PollableChannel cmChannel5; - - @Autowired - private PollableChannel cmChannel6; - - @Autowired - private HazelcastInstance hazelcastInstance; - - @Autowired - private HazelcastInstance hazelcastInstance2; - - @Autowired - private HazelcastInstance hazelcastInstance3; - - @AfterClass - public static void shutdown() { - HazelcastInstanceFactory.terminateAll(); - } - - @Test - public void testDistributedObjectEvent() { - HazelcastInboundChannelAdapterTestUtils - .testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel2, - hazelcastInstance, "Test_Distributed_Map4"); - } - - @Test - public void testLifecycleEvent() { - hazelcastInstance2.getLifecycleService().terminate(); - - Message msg = - cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT); - verifyLifecycleEvent(msg, LifecycleState.SHUTTING_DOWN); - - msg = cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT); - verifyLifecycleEvent(msg, LifecycleState.SHUTDOWN); - } - - private void verifyLifecycleEvent(final Message msg, - final LifecycleState lifecycleState) { - assertThat(msg).isNotNull(); - assertThat(msg.getPayload()).isNotNull(); - assertThat(msg.getPayload() instanceof LifecycleEvent).isTrue(); - assertThat(((LifecycleEvent) msg.getPayload()).getState()).isEqualTo(lifecycleState); - } - -} diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java index 39aff6b3f4..bbacc0c3d9 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.collection.IList; import com.hazelcast.core.EntryEventType; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat; * Hazelcast Distributed List Event Driven Inbound Channel Adapter Test Class * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests { @@ -70,7 +69,8 @@ public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.ADDED.toString()); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getId()).isEqualTo(1); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getName()).isEqualTo("TestName1"); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()).isEqualTo("TestSurname1"); @@ -85,7 +85,8 @@ public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.REMOVED.toString()); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getId()).isEqualTo(2); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getName()).isEqualTo("TestName2"); assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()).isEqualTo("TestSurname2"); diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java index 613521adb0..5383c7708a 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.core.EntryEventType; import com.hazelcast.map.IMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -38,10 +36,11 @@ import static org.assertj.core.api.Assertions.assertThat; * Hazelcast Distributed Map Event Driven Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedMapEventDrivenInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java index 55376190ec..268d0fd13d 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.collection.IQueue; import com.hazelcast.core.EntryEventType; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat; * Hazelcast Distributed Queue Event Driven Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests { @@ -72,7 +71,8 @@ public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.ADDED.toString()); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(1); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName1"); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname1"); @@ -89,7 +89,8 @@ public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.REMOVED.toString()); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(2); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName2"); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname2"); diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java index 5deb3f0458..dfd87f47c7 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,24 +17,23 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.map.IMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * Hazelcast Distributed SQL Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedSQLInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java index 0b66aa002e..ee6ac6ca36 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.collection.ISet; import com.hazelcast.core.EntryEventType; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat; * Hazelcast Distributed Set Event Driven Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests { @@ -72,7 +71,8 @@ public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.ADDED.toString()); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(1); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName1"); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname1"); @@ -89,7 +89,8 @@ public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests { assertThat(msg).isNotNull(); assertThat(msg.getPayload()).isNotNull(); assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull(); - assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString()); + assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()) + .isEqualTo(EntryEventType.REMOVED.toString()); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(2); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName2"); assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname2"); diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java index a2440edbac..836932edb9 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,24 +17,23 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.topic.ITopic; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * Hazelcast Distributed Topic Event Driven Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java index 07e4e8e8a6..75d0aad503 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.core.EntryEventType; import com.hazelcast.multimap.MultiMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -39,10 +37,10 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Eren Avsarogullari * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastMultiMapEventDrivenInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java index 306c80ae6c..bfd74ac00c 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound; import com.hazelcast.core.EntryEventType; import com.hazelcast.replicatedmap.ReplicatedMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastHeaders; @@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa import org.springframework.messaging.Message; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import static org.assertj.core.api.Assertions.assertThat; @@ -38,10 +36,11 @@ import static org.assertj.core.api.Assertions.assertThat; * Hazelcast Replicated Map Event Driven Inbound Channel Adapter Test * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration +@SpringJUnitConfig @DirtiesContext @SuppressWarnings({"unchecked", "rawtypes"}) public class HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java index 8d3dc72402..83ba97b278 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,26 +17,25 @@ package org.springframework.integration.hazelcast.inbound.config; import com.hazelcast.map.IMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.context.support.AnnotationConfigContextLoader; /** * Hazelcast Continuous Query Inbound Channel Adapter JavaConfig driven Unit Test Class * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class, +@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class, loader = AnnotationConfigContextLoader.class) @DirtiesContext public class HazelcastCQDistributedMapInboundChannelAdapterConfigTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java index 6b550c03ce..a34714a518 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,25 +17,24 @@ package org.springframework.integration.hazelcast.inbound.config; import com.hazelcast.core.HazelcastInstance; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; /** * Hazelcast Cluster Monitor Inbound Channel Adapter JavaConfig driven Unit Test Class * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class) +@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class) @DirtiesContext public class HazelcastClusterMonitorInboundChannelAdapterConfigTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java index e5d8921ca5..0cc0d6748d 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,26 +17,25 @@ package org.springframework.integration.hazelcast.inbound.config; import com.hazelcast.map.IMap; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.context.support.AnnotationConfigContextLoader; /** * Hazelcast Distributed SQL Inbound Channel Adapter JavaConfig driven Unit Test Class * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class, +@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class, loader = AnnotationConfigContextLoader.class) @DirtiesContext public class HazelcastDistributedSQLInboundChannelAdapterConfigTests { diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java index 31dde31112..90b0688e48 100644 --- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java +++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,26 +23,25 @@ import com.hazelcast.map.IMap; import com.hazelcast.multimap.MultiMap; import com.hazelcast.replicatedmap.ReplicatedMap; import com.hazelcast.topic.ITopic; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser; import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils; import org.springframework.messaging.PollableChannel; import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; import org.springframework.test.context.support.AnnotationConfigContextLoader; /** * Hazelcast Event Driven Inbound Channel Adapter JavaConfig driven Unit Test Class * * @author Eren Avsarogullari + * @author Artem Bilan + * * @since 6.0 */ -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class, +@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class, loader = AnnotationConfigContextLoader.class) @DirtiesContext public class HazelcastEventDrivenInboundChannelAdapterConfigTests {