GH-25 - Polishing.

This commit is contained in:
Oliver Drotbohm
2022-07-27 13:23:49 +02:00
parent 97a5051930
commit 9512c36c32
2 changed files with 14 additions and 12 deletions

View File

@@ -20,6 +20,8 @@ import static org.mockito.Mockito.*;
import lombok.Value;
import java.time.temporal.ChronoUnit;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
@@ -36,8 +38,6 @@ import org.springframework.modulith.testapp.TestApplication;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import java.time.temporal.ChronoUnit;
/**
* Integration tests for {@link JdbcEventPublicationRepository}.
*
@@ -98,8 +98,7 @@ class JdbcEventPublicationRepositoryIntegrationTests {
@Nested
class Update {
@Test
// GH-3
@Test // GH-3
void shouldUpdateSingleEventPublication() {
var testEvent1 = new TestEvent("id1");
@@ -138,7 +137,8 @@ class JdbcEventPublicationRepositoryIntegrationTests {
when(serializer.serialize(testEvent)).thenReturn(serializedEvent);
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)).isEmpty();
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER))
.isEmpty();
}
@Test // GH-3
@@ -160,7 +160,7 @@ class JdbcEventPublicationRepositoryIntegrationTests {
assertThat(actual).isEmpty();
}
@Test // GH-3 //
@Test // GH-3
void shouldReturnTheOldestEvent() throws Exception {
var testEvent = new TestEvent("id");
@@ -180,12 +180,12 @@ class JdbcEventPublicationRepositoryIntegrationTests {
assertThat(actual).hasValueSatisfying(it -> {
assertThat(it.getPublicationDate()) //
.isCloseTo(publicationOld.getPublicationDate(), within(1, ChronoUnit.MILLIS));
.isCloseTo(publicationOld.getPublicationDate(), within(1, ChronoUnit.MILLIS));
});
}
@Test
// GH-3
// GH-3
void shouldSilentlyIgnoreNotSerializableEvents() {
var testEvent = new TestEvent("id");
@@ -199,7 +199,8 @@ class JdbcEventPublicationRepositoryIntegrationTests {
operations.update("UPDATE EVENT_PUBLICATION SET EVENT_TYPE='abc'");
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)).isEmpty();
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER))
.isEmpty();
}
}
}

View File

@@ -127,7 +127,8 @@ class JpaEventPublicationRepositoryIntegrationTests {
assertThat(eventPublications).hasSize(1);
assertThat(eventPublications.get(0).getEvent()).isEqualTo(publication.getEvent());
assertThat(eventPublications.get(0).getTargetIdentifier()).isEqualTo(publication.getTargetIdentifier());
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)).isPresent();
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER))
.isPresent();
// Complete publication
repository.update(publication.markCompleted());
@@ -135,7 +136,7 @@ class JpaEventPublicationRepositoryIntegrationTests {
assertThat(repository.findIncompletePublications()).isEmpty();
}
@Test
@Test // GH-25
void shouldTolerateEmptyResult() {
var testEvent = new TestEvent("id");
@@ -146,7 +147,7 @@ class JpaEventPublicationRepositoryIntegrationTests {
assertThat(repository.findIncompletePublicationsByEventAndTargetIdentifier(testEvent, TARGET_IDENTIFIER)).isEmpty();
}
@Test
@Test // GH-25
void shouldNotReturnCompletedEvents() {
TestEvent testEvent = new TestEvent("abc");