From ce83e620384be3edba90e6f79b95ff40d532f3f2 Mon Sep 17 00:00:00 2001 From: Cora Iberkleid Date: Mon, 21 Oct 2024 12:31:51 -0400 Subject: [PATCH] GH-806 - Remove use of Lombok. Co-authored-by: Oliver Drotbohm --- .../EventExternalizationConfigurationUnitTests.java | 8 ++++---- .../PersistentApplicationEventMulticasterUnitTests.java | 7 ++++--- .../JdbcEventPublicationRepositoryIntegrationTests.java | 7 +------ ...EventPublicationAutoConfigurationIntegrationTests.java | 8 +++++--- .../JpaEventPublicationConfigurationIntegrationTests.java | 8 +++++--- .../JpaEventPublicationRepositoryIntegrationTests.java | 5 +---- .../mongodb/MongoDbEventPublicationRepositoryTest.java | 7 +------ .../events/neo4j/Neo4jEventPublicationRepositoryTest.java | 7 +------ 8 files changed, 22 insertions(+), 35 deletions(-) diff --git a/spring-modulith-events/spring-modulith-events-api/src/test/java/org/springframework/modulith/events/EventExternalizationConfigurationUnitTests.java b/spring-modulith-events/spring-modulith-events-api/src/test/java/org/springframework/modulith/events/EventExternalizationConfigurationUnitTests.java index 556f3f47..241ed98d 100644 --- a/spring-modulith-events/spring-modulith-events-api/src/test/java/org/springframework/modulith/events/EventExternalizationConfigurationUnitTests.java +++ b/spring-modulith-events/spring-modulith-events-api/src/test/java/org/springframework/modulith/events/EventExternalizationConfigurationUnitTests.java @@ -18,11 +18,8 @@ import static org.assertj.core.api.Assertions.*; import static org.springframework.modulith.events.EventExternalizationConfiguration.*; -import lombok.RequiredArgsConstructor; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.List; import java.util.Map; import org.junit.jupiter.api.Test; @@ -160,11 +157,14 @@ static class AnotherSampleEvent {} @Externalized("::key") static class KeyOnlyAnnotated {} - @RequiredArgsConstructor static class WithKeyProperty { private final String key; + WithKeyProperty(String key) { + this.key = key; + } + String getKey() { return key; } diff --git a/spring-modulith-events/spring-modulith-events-core/src/test/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticasterUnitTests.java b/spring-modulith-events/spring-modulith-events-core/src/test/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticasterUnitTests.java index 10cc5fe9..8308f987 100644 --- a/spring-modulith-events/spring-modulith-events-core/src/test/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticasterUnitTests.java +++ b/spring-modulith-events/spring-modulith-events-core/src/test/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticasterUnitTests.java @@ -19,8 +19,6 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; -import lombok.AllArgsConstructor; - import java.util.List; import java.util.Map; @@ -132,8 +130,11 @@ static class ConditionalListener { void on(SampleEvent event) {} } - @AllArgsConstructor static class SampleEvent { public boolean supported; + + public SampleEvent(boolean supported) { + this.supported = supported; + } } } diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java index ea8083e8..74ff9f9b 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/test/java/org/springframework/modulith/events/jdbc/JdbcEventPublicationRepositoryIntegrationTests.java @@ -20,8 +20,6 @@ import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.*; -import lombok.Value; - import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.time.Instant; @@ -485,10 +483,7 @@ class OracleWithNoDefinedSchemaName extends WithNoDefinedSchemaName {} @WithOracle class OracleWithDeleteCompletion extends WithDeleteCompletion {} - @Value - private static final class TestEvent { - String eventId; - } + private record TestEvent(String eventId) {} private static final class Sample {} diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java index ae9ae88b..b3919386 100644 --- a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationAutoConfigurationIntegrationTests.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.*; import example.ExampleApplication; -import lombok.RequiredArgsConstructor; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.BeanFactory; @@ -36,14 +35,17 @@ @SpringBootTest @ContextConfiguration(classes = ExampleApplication.class) @TestConstructor(autowireMode = AutowireMode.ALL) -@RequiredArgsConstructor class JpaEventPublicationAutoConfigurationIntegrationTests { private final BeanFactory factory; @MockitoBean EventSerializer serializer; - @Test // GH-10 + JpaEventPublicationAutoConfigurationIntegrationTests(BeanFactory factory) { + this.factory = factory; + } + + @Test // GH-10 void registersJpaEventPublicationPackageForAutoConfiguration() { var examplePackage = ExampleApplication.class.getPackageName(); diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java index a39265c2..af1d03e9 100644 --- a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationConfigurationIntegrationTests.java @@ -18,7 +18,6 @@ import static org.assertj.core.api.Assertions.*; import example.ExampleApplication; -import lombok.RequiredArgsConstructor; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @@ -36,14 +35,17 @@ */ @SpringBootTest(classes = ExampleApplication.class) @TestConstructor(autowireMode = AutowireMode.ALL) -@RequiredArgsConstructor class JpaEventPublicationConfigurationIntegrationTests { private final ApplicationContext context; @MockitoBean EventSerializer serializer; - @Test + JpaEventPublicationConfigurationIntegrationTests(ApplicationContext context) { + this.context = context; + } + + @Test void bootstrapsApplicationComponents() { assertThat(context.getBean(EventPublicationRegistry.class)).isNotNull(); diff --git a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationRepositoryIntegrationTests.java b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationRepositoryIntegrationTests.java index cf4eebac..1d69929a 100644 --- a/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationRepositoryIntegrationTests.java +++ b/spring-modulith-events/spring-modulith-events-jpa/src/test/java/org/springframework/modulith/events/jpa/JpaEventPublicationRepositoryIntegrationTests.java @@ -325,8 +325,5 @@ private void savePublicationAt(LocalDateTime date) { em.persist(new JpaEventPublication(UUID.randomUUID(), date.toInstant(ZoneOffset.UTC), "", "", Object.class)); } - @lombok.Value - private static final class TestEvent { - String eventId; - } + private record TestEvent(String eventId) {} } diff --git a/spring-modulith-events/spring-modulith-events-mongodb/src/test/java/org/springframework/modulith/events/mongodb/MongoDbEventPublicationRepositoryTest.java b/spring-modulith-events/spring-modulith-events-mongodb/src/test/java/org/springframework/modulith/events/mongodb/MongoDbEventPublicationRepositoryTest.java index 870ca599..28c87d22 100644 --- a/spring-modulith-events/spring-modulith-events-mongodb/src/test/java/org/springframework/modulith/events/mongodb/MongoDbEventPublicationRepositoryTest.java +++ b/spring-modulith-events/spring-modulith-events-mongodb/src/test/java/org/springframework/modulith/events/mongodb/MongoDbEventPublicationRepositoryTest.java @@ -18,8 +18,6 @@ import static org.assertj.core.api.Assertions.*; import static org.junit.jupiter.api.Assumptions.*; -import lombok.Value; - import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; @@ -312,8 +310,5 @@ void deletesPublicationsByIdentifier() { @TestPropertySource(properties = CompletionMode.PROPERTY + "=DELETE") static class WithDeleteCompletionTest extends MongoDbEventPublicationRepositoryTest {} - @Value - private static final class TestEvent { - String eventId; - } + private record TestEvent(String eventId) {} } diff --git a/spring-modulith-events/spring-modulith-events-neo4j/src/test/java/org/springframework/modulith/events/neo4j/Neo4jEventPublicationRepositoryTest.java b/spring-modulith-events/spring-modulith-events-neo4j/src/test/java/org/springframework/modulith/events/neo4j/Neo4jEventPublicationRepositoryTest.java index 293839a1..fbe08d91 100644 --- a/spring-modulith-events/spring-modulith-events-neo4j/src/test/java/org/springframework/modulith/events/neo4j/Neo4jEventPublicationRepositoryTest.java +++ b/spring-modulith-events/spring-modulith-events-neo4j/src/test/java/org/springframework/modulith/events/neo4j/Neo4jEventPublicationRepositoryTest.java @@ -19,8 +19,6 @@ import static org.junit.jupiter.api.Assumptions.*; import static org.mockito.Mockito.*; -import lombok.Value; - import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; @@ -306,10 +304,7 @@ private TargetEventPublication createPublication(Object event) { @TestPropertySource(properties = CompletionMode.PROPERTY + "=DELETE") static class WithDeleteCompletionTest extends Neo4jEventPublicationRepositoryTest {} - @Value - static class TestEvent { - String eventId; - } + private record TestEvent(String eventId) {} @Import({ TestApplication.class }) @Configuration