From 729222c763bf6ebde3ab42708fdaf6073373b129 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 14 Jul 2020 15:20:42 +0200 Subject: [PATCH] #390 - Polishing. Add author tags and ticket references to tests. --- .../core/DefaultDatabaseClientUnitTests.java | 3 +- .../H2R2dbcRepositoryIntegrationTests.java | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/test/java/org/springframework/data/r2dbc/core/DefaultDatabaseClientUnitTests.java b/src/test/java/org/springframework/data/r2dbc/core/DefaultDatabaseClientUnitTests.java index a29c2e3..c889fa6 100644 --- a/src/test/java/org/springframework/data/r2dbc/core/DefaultDatabaseClientUnitTests.java +++ b/src/test/java/org/springframework/data/r2dbc/core/DefaultDatabaseClientUnitTests.java @@ -57,6 +57,7 @@ import org.springframework.lang.Nullable; * @author Mark Paluch * @author Ferdinand Jacobs * @author Jens Schauder + * @author Zsombor Gegesy */ @RunWith(MockitoJUnitRunner.class) public class DefaultDatabaseClientUnitTests { @@ -249,7 +250,7 @@ public class DefaultDatabaseClientUnitTests { verify(statement).bindNull(1, Integer.class); } - @Test + @Test // gh-390 public void insertShouldWorkWithoutValues() { Statement statement = mockStatementFor("INSERT INTO id_only VALUES ()"); diff --git a/src/test/java/org/springframework/data/r2dbc/repository/H2R2dbcRepositoryIntegrationTests.java b/src/test/java/org/springframework/data/r2dbc/repository/H2R2dbcRepositoryIntegrationTests.java index 87e5942..192fe96 100644 --- a/src/test/java/org/springframework/data/r2dbc/repository/H2R2dbcRepositoryIntegrationTests.java +++ b/src/test/java/org/springframework/data/r2dbc/repository/H2R2dbcRepositoryIntegrationTests.java @@ -15,6 +15,8 @@ */ package org.springframework.data.r2dbc.repository; +import static org.assertj.core.api.Assertions.*; + import io.r2dbc.spi.ConnectionFactory; import lombok.Getter; import lombok.NoArgsConstructor; @@ -29,7 +31,6 @@ import javax.sql.DataSource; import org.junit.Test; import org.junit.runner.RunWith; -import static org.assertj.core.api.Assertions.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -50,6 +51,7 @@ import org.springframework.test.context.junit4.SpringRunner; * Integration tests for {@link LegoSetRepository} using {@link R2dbcRepositoryFactory} against H2. * * @author Mark Paluch + * @author Zsombor Gegesy */ @RunWith(SpringRunner.class) @ContextConfiguration @@ -70,17 +72,6 @@ public class H2R2dbcRepositoryIntegrationTests extends AbstractR2dbcRepositoryIn } } - interface IdOnlyEntityRepository extends ReactiveCrudRepository { - } - - @Getter - @Setter - @Table("id_only") - @NoArgsConstructor - static class IdOnlyEntity { - @Id Integer id; - } - @Override protected DataSource createDataSource() { return H2TestSupport.createDataSource(); @@ -133,8 +124,9 @@ public class H2R2dbcRepositoryIntegrationTests extends AbstractR2dbcRepositoryIn repository.updateManualAndReturnNothing(42).as(StepVerifier::create).verifyComplete(); } - @Test + @Test // gh-390 public void shouldInsertIdOnlyEntity() { + this.jdbc.execute("CREATE TABLE ID_ONLY(id serial CONSTRAINT id_only_pk PRIMARY KEY)"); IdOnlyEntity entity1 = new IdOnlyEntity(); @@ -175,4 +167,14 @@ public class H2R2dbcRepositoryIntegrationTests extends AbstractR2dbcRepositoryIn @Modifying Mono updateManualAndReturnDouble(int manual); } + + interface IdOnlyEntityRepository extends ReactiveCrudRepository {} + + @Getter + @Setter + @Table("id_only") + @NoArgsConstructor + static class IdOnlyEntity { + @Id Integer id; + } }