From 0f1de5ec7179fad68b5714253725b71f6155e203 Mon Sep 17 00:00:00 2001 From: "bartlomiej.zylinski" Date: Tue, 18 Jun 2024 08:03:03 +0200 Subject: [PATCH 1/2] Fix review issues --- docker-compose.yaml | 2 -- .../java/otter/jet/plaintext/PlainTextMessageReaderTest.java | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1c2b37d..da0c292 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,3 @@ -version: '3.9' - volumes: nats-storage: driver: local diff --git a/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java b/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java index 0a9c387..aeea381 100644 --- a/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java +++ b/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java @@ -9,7 +9,6 @@ import java.time.LocalDateTime; import java.time.ZoneOffset; -import org.assertj.core.api.Assertions; import otter.jet.AbstractIntegrationTest; import otter.jet.JetStreamContainerInitializer; import otter.jet.JetStreamUtils; @@ -50,7 +49,7 @@ public void shouldReadMessagesSentInPlaintext() { await() .untilAsserted( () -> - Assertions.assertThat(readerService.filter(subjectFilter, typeFilter, 0, 10, "")) + assertThat(readerService.filter(subjectFilter, typeFilter, 0, 10, "")) .usingRecursiveFieldByFieldElementComparator( ComparisonConfiguration.configureReadMessageComparison()) .contains( From d3534e3ce60533a9c19aa3e233e9921fd1c1d89a Mon Sep 17 00:00:00 2001 From: "bartlomiej.zylinski" Date: Tue, 25 Jun 2024 11:23:33 +0200 Subject: [PATCH 2/2] Added Google Code Style --- intellij-java-google-style.xml | 598 ++++++++++++++++++ .../examples/RandomProtoPersonGenerator.java | 1 + .../plaintext/PlainTextMessageReaderTest.java | 41 +- 3 files changed, 616 insertions(+), 24 deletions(-) create mode 100644 intellij-java-google-style.xml diff --git a/intellij-java-google-style.xml b/intellij-java-google-style.xml new file mode 100644 index 0000000..f3a6743 --- /dev/null +++ b/intellij-java-google-style.xml @@ -0,0 +1,598 @@ + + + + + + diff --git a/src/test/java/otter/jet/examples/RandomProtoPersonGenerator.java b/src/test/java/otter/jet/examples/RandomProtoPersonGenerator.java index 638fd15..1518a21 100644 --- a/src/test/java/otter/jet/examples/RandomProtoPersonGenerator.java +++ b/src/test/java/otter/jet/examples/RandomProtoPersonGenerator.java @@ -5,6 +5,7 @@ import otter.jet.examples.protobuf.PersonProtos; public class RandomProtoPersonGenerator { + @NotNull public static PersonProtos.Person randomPerson() { Faker faker = new Faker(); diff --git a/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java b/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java index 4809f12..33aca3b 100644 --- a/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java +++ b/src/test/java/otter/jet/plaintext/PlainTextMessageReaderTest.java @@ -1,14 +1,12 @@ package otter.jet.plaintext; -import static org.awaitility.Awaitility.await; - import com.github.javafaker.Faker; + import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; -import org.assertj.core.api.Assertions; import otter.jet.AbstractIntegrationTest; import otter.jet.JetStreamContainerInitializer; import otter.jet.JetStreamUtils; @@ -21,41 +19,36 @@ import otter.jet.store.Filters; import otter.jet.store.MessageStore; +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Awaitility.await; + @TestPropertySource(properties = {"read.mode=plaintext", "read.subject=plaintext"}) class PlainTextMessageReaderTest extends AbstractIntegrationTest { - private static final LocalDateTime ignoredMessageTimestamp = - LocalDateTime.ofInstant(Instant.EPOCH, ZoneOffset.UTC); - @Autowired private MessageStore messageStore; - @Autowired private ReaderConfigurationProperties readerConfigurationProperties; + private static final LocalDateTime ignoredMessageTimestamp = LocalDateTime.ofInstant( + Instant.EPOCH, ZoneOffset.UTC); + @Autowired + private MessageStore messageStore; + @Autowired + private ReaderConfigurationProperties readerConfigurationProperties; @Test public void shouldReadMessagesSentInPlaintext() { // given - JetStreamUtils.createSubjectStream( - readerConfigurationProperties.getSubject(), + JetStreamUtils.createSubjectStream(readerConfigurationProperties.getSubject(), JetStreamContainerInitializer.getNatsServerUrl()); String randomName = new Faker().name().fullName(); byte[] data = randomName.getBytes(StandardCharsets.UTF_8); // when - JetStreamUtils.tryToSendMessage( - data, - readerConfigurationProperties.getSubject(), + JetStreamUtils.tryToSendMessage(data, readerConfigurationProperties.getSubject(), JetStreamContainerInitializer.getNatsServerUrl()); // then - await() - .untilAsserted( - () -> - Assertions.assertThat(messageStore.filter(Filters.empty(), 0, 10)) - .usingRecursiveFieldByFieldElementComparator( - ComparisonConfiguration.configureReadMessageComparison()) - .contains( - new ReadMessage( - readerConfigurationProperties.getSubject(), - "", - randomName, - ignoredMessageTimestamp))); + await().untilAsserted(() -> assertThat( + messageStore.filter(Filters.empty(), 0, 10)).usingRecursiveFieldByFieldElementComparator( + ComparisonConfiguration.configureReadMessageComparison()).contains( + new ReadMessage(readerConfigurationProperties.getSubject(), "", randomName, + ignoredMessageTimestamp))); } }