diff --git a/src/main/java/org/springframework/data/r2dbc/function/DatabaseClient.java b/src/main/java/org/springframework/data/r2dbc/function/DatabaseClient.java index af76033..2c108e7 100644 --- a/src/main/java/org/springframework/data/r2dbc/function/DatabaseClient.java +++ b/src/main/java/org/springframework/data/r2dbc/function/DatabaseClient.java @@ -65,8 +65,9 @@ public interface DatabaseClient { /** * Creates a {@code DatabaseClient} that will use the provided {@link io.r2dbc.spi.ConnectionFactory}. + * * @param factory The {@code ConnectionFactory} to use for obtaining connections. - * @return a new {@code DatabaseClient}. Guaranteed to be not {@code null}. + * @return a new {@code DatabaseClient}. Guaranteed to be not {@literal null}. */ static DatabaseClient create(ConnectionFactory factory) { return new DefaultDatabaseClientBuilder().connectionFactory(factory).build(); @@ -163,7 +164,7 @@ public interface DatabaseClient { * * @param mappingFunction must not be {@literal null}. * @param result type. - * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}. + * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}. */ FetchSpec map(BiFunction mappingFunction); @@ -199,7 +200,7 @@ public interface DatabaseClient { * * @param mappingFunction must not be {@literal null}. * @param result type. - * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}. + * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}. */ FetchSpec map(BiFunction mappingFunction); @@ -225,7 +226,8 @@ public interface DatabaseClient { * Specify the source {@literal table} to select from. * * @param table must not be {@literal null} or empty. - * @return a {@link GenericSelectSpec} for further configuration of the select. Guaranteed to be not {@code null}. + * @return a {@link GenericSelectSpec} for further configuration of the select. Guaranteed to be not + * {@literal null}. */ GenericSelectSpec from(String table); @@ -233,7 +235,7 @@ public interface DatabaseClient { * Specify the source table to select from to using the {@link Class entity class}. * * @param table must not be {@literal null}. - * @return a {@link TypedSelectSpec} for further configuration of the select. Guaranteed to be not {@code null}. + * @return a {@link TypedSelectSpec} for further configuration of the select. Guaranteed to be not {@literal null}. */ TypedSelectSpec from(Class table); } @@ -247,7 +249,8 @@ public interface DatabaseClient { * Specify the target {@literal table} to insert into. * * @param table must not be {@literal null} or empty. - * @return a {@link GenericInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}. + * @return a {@link GenericInsertSpec} for further configuration of the insert. Guaranteed to be not + * {@literal null}. */ GenericInsertSpec> into(String table); @@ -255,7 +258,7 @@ public interface DatabaseClient { * Specify the target table to insert to using the {@link Class entity class}. * * @param table must not be {@literal null}. - * @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}. + * @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}. */ TypedInsertSpec into(Class table); } @@ -279,7 +282,7 @@ public interface DatabaseClient { * * @param mappingFunction must not be {@literal null}. * @param result type. - * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}. + * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}. */ FetchSpec map(BiFunction mappingFunction); @@ -308,7 +311,7 @@ public interface DatabaseClient { * * @param mappingFunction must not be {@literal null}. * @param result type. - * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}. + * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}. */ FetchSpec map(BiFunction mappingFunction); @@ -377,8 +380,9 @@ public interface DatabaseClient { /** * Insert the given {@code objectToInsert}. * - * @param objectToInsert the object of which the attributes will provide the values for the insert. Must not be {@code null}. - * @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}. + * @param objectToInsert the object of which the attributes will provide the values for the insert. Must not be + * {@literal null}. + * @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}. */ InsertSpec> using(T objectToInsert); @@ -386,7 +390,7 @@ public interface DatabaseClient { * Use the given {@code tableName} as insert target. * * @param tableName must not be {@literal null} or empty. - * @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}. + * @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}. */ TypedInsertSpec table(String tableName); @@ -394,8 +398,9 @@ public interface DatabaseClient { * Insert the given {@link Publisher} to insert one or more objects. Inserts only a single object when calling * {@link FetchSpec#one()} or {@link FetchSpec#first()}. * - * @param objectToInsert a publisher providing the objects of which the attributes will provide the values for the insert. Must not be {@code null}. - * @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}. + * @param objectToInsert a publisher providing the objects of which the attributes will provide the values for the + * insert. Must not be {@literal null}. + * @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}. * @see InsertSpec#fetch() */ InsertSpec> using(Publisher objectToInsert); @@ -413,7 +418,7 @@ public interface DatabaseClient { * * @param mappingFunction must not be {@literal null}. * @param result type. - * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}. + * @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}. */ FetchSpec map(BiFunction mappingFunction); diff --git a/src/test/java/org/springframework/data/r2dbc/function/AbstractDatabaseClientIntegrationTests.java b/src/test/java/org/springframework/data/r2dbc/function/AbstractDatabaseClientIntegrationTests.java index 6ed34c8..6f78cc7 100644 --- a/src/test/java/org/springframework/data/r2dbc/function/AbstractDatabaseClientIntegrationTests.java +++ b/src/test/java/org/springframework/data/r2dbc/function/AbstractDatabaseClientIntegrationTests.java @@ -15,8 +15,16 @@ */ package org.springframework.data.r2dbc.function; +import static org.assertj.core.api.Assertions.*; +import static org.springframework.data.domain.Sort.Order.*; + import io.r2dbc.spi.ConnectionFactory; import lombok.Data; +import reactor.core.publisher.Hooks; +import reactor.test.StepVerifier; + +import javax.sql.DataSource; + import org.junit.Before; import org.junit.Test; import org.springframework.dao.DataAccessException; @@ -26,14 +34,6 @@ import org.springframework.data.domain.Sort; import org.springframework.data.r2dbc.testing.R2dbcIntegrationTestSupport; import org.springframework.data.relational.core.mapping.Table; import org.springframework.jdbc.core.JdbcTemplate; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Hooks; -import reactor.test.StepVerifier; - -import javax.sql.DataSource; - -import static org.assertj.core.api.Assertions.*; -import static org.springframework.data.domain.Sort.Order.*; /** * Integration tests for {@link DatabaseClient}. @@ -57,8 +57,7 @@ public abstract class AbstractDatabaseClientIntegrationTests extends R2dbcIntegr try { jdbc.execute("DROP TABLE legoset"); - } catch (DataAccessException e) { - } + } catch (DataAccessException e) {} jdbc.execute(getCreateTableStatement()); } @@ -107,9 +106,6 @@ public abstract class AbstractDatabaseClientIntegrationTests extends R2dbcIntegr .expectNext(1) // .verifyComplete(); - Flux rows = databaseClient.select().from("legoset").orderBy(Sort.by(desc("id"))).as(LegoSet.class).fetch() - .all(); - assertThat(jdbc.queryForMap("SELECT id, name, manual FROM legoset")).containsEntry("id", 42055); }