Skip to content

Commit 6ad31ab

Browse files
mp911deschauder
authored andcommitted
#8 - Address review feedback.
Remove unused code from AbstractDatabaseClientIntegrationTests. Use literal null instead of code null for consistency. Original pull request: #33.
1 parent 7db8e64 commit 6ad31ab

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

src/main/java/org/springframework/data/r2dbc/function/DatabaseClient.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ public interface DatabaseClient {
6565

6666
/**
6767
* Creates a {@code DatabaseClient} that will use the provided {@link io.r2dbc.spi.ConnectionFactory}.
68+
*
6869
* @param factory The {@code ConnectionFactory} to use for obtaining connections.
69-
* @return a new {@code DatabaseClient}. Guaranteed to be not {@code null}.
70+
* @return a new {@code DatabaseClient}. Guaranteed to be not {@literal null}.
7071
*/
7172
static DatabaseClient create(ConnectionFactory factory) {
7273
return new DefaultDatabaseClientBuilder().connectionFactory(factory).build();
@@ -163,7 +164,7 @@ interface GenericExecuteSpec extends BindSpec<GenericExecuteSpec> {
163164
*
164165
* @param mappingFunction must not be {@literal null}.
165166
* @param <R> result type.
166-
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}.
167+
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}.
167168
*/
168169
<R> FetchSpec<R> map(BiFunction<Row, RowMetadata, R> mappingFunction);
169170

@@ -199,7 +200,7 @@ interface TypedExecuteSpec<T> extends BindSpec<TypedExecuteSpec<T>> {
199200
*
200201
* @param mappingFunction must not be {@literal null}.
201202
* @param <R> result type.
202-
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}.
203+
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}.
203204
*/
204205
<R> FetchSpec<R> map(BiFunction<Row, RowMetadata, R> mappingFunction);
205206

@@ -225,15 +226,16 @@ interface SelectFromSpec {
225226
* Specify the source {@literal table} to select from.
226227
*
227228
* @param table must not be {@literal null} or empty.
228-
* @return a {@link GenericSelectSpec} for further configuration of the select. Guaranteed to be not {@code null}.
229+
* @return a {@link GenericSelectSpec} for further configuration of the select. Guaranteed to be not
230+
* {@literal null}.
229231
*/
230232
GenericSelectSpec from(String table);
231233

232234
/**
233235
* Specify the source table to select from to using the {@link Class entity class}.
234236
*
235237
* @param table must not be {@literal null}.
236-
* @return a {@link TypedSelectSpec} for further configuration of the select. Guaranteed to be not {@code null}.
238+
* @return a {@link TypedSelectSpec} for further configuration of the select. Guaranteed to be not {@literal null}.
237239
*/
238240
<T> TypedSelectSpec<T> from(Class<T> table);
239241
}
@@ -247,15 +249,16 @@ interface InsertIntoSpec {
247249
* Specify the target {@literal table} to insert into.
248250
*
249251
* @param table must not be {@literal null} or empty.
250-
* @return a {@link GenericInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}.
252+
* @return a {@link GenericInsertSpec} for further configuration of the insert. Guaranteed to be not
253+
* {@literal null}.
251254
*/
252255
GenericInsertSpec<Map<String, Object>> into(String table);
253256

254257
/**
255258
* Specify the target table to insert to using the {@link Class entity class}.
256259
*
257260
* @param table must not be {@literal null}.
258-
* @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}.
261+
* @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}.
259262
*/
260263
<T> TypedInsertSpec<T> into(Class<T> table);
261264
}
@@ -279,7 +282,7 @@ interface GenericSelectSpec extends SelectSpec<GenericSelectSpec> {
279282
*
280283
* @param mappingFunction must not be {@literal null}.
281284
* @param <R> result type.
282-
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}.
285+
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}.
283286
*/
284287
<R> FetchSpec<R> map(BiFunction<Row, RowMetadata, R> mappingFunction);
285288

@@ -308,7 +311,7 @@ interface TypedSelectSpec<T> extends SelectSpec<TypedSelectSpec<T>> {
308311
*
309312
* @param mappingFunction must not be {@literal null}.
310313
* @param <R> result type.
311-
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}.
314+
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}.
312315
*/
313316
<R> FetchSpec<R> map(BiFunction<Row, RowMetadata, R> mappingFunction);
314317

@@ -377,25 +380,27 @@ interface TypedInsertSpec<T> {
377380
/**
378381
* Insert the given {@code objectToInsert}.
379382
*
380-
* @param objectToInsert the object of which the attributes will provide the values for the insert. Must not be {@code null}.
381-
* @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}.
383+
* @param objectToInsert the object of which the attributes will provide the values for the insert. Must not be
384+
* {@literal null}.
385+
* @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}.
382386
*/
383387
InsertSpec<Map<String, Object>> using(T objectToInsert);
384388

385389
/**
386390
* Use the given {@code tableName} as insert target.
387391
*
388392
* @param tableName must not be {@literal null} or empty.
389-
* @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}.
393+
* @return a {@link TypedInsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}.
390394
*/
391395
TypedInsertSpec<T> table(String tableName);
392396

393397
/**
394398
* Insert the given {@link Publisher} to insert one or more objects. Inserts only a single object when calling
395399
* {@link FetchSpec#one()} or {@link FetchSpec#first()}.
396400
*
397-
* @param objectToInsert a publisher providing the objects of which the attributes will provide the values for the insert. Must not be {@code null}.
398-
* @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@code null}.
401+
* @param objectToInsert a publisher providing the objects of which the attributes will provide the values for the
402+
* insert. Must not be {@literal null}.
403+
* @return a {@link InsertSpec} for further configuration of the insert. Guaranteed to be not {@literal null}.
399404
* @see InsertSpec#fetch()
400405
*/
401406
InsertSpec<Map<String, Object>> using(Publisher<T> objectToInsert);
@@ -413,7 +418,7 @@ interface InsertSpec<T> {
413418
*
414419
* @param mappingFunction must not be {@literal null}.
415420
* @param <R> result type.
416-
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@code null}.
421+
* @return a {@link FetchSpec} for configuration what to fetch. Guaranteed to be not {@literal null}.
417422
*/
418423
<R> FetchSpec<R> map(BiFunction<Row, RowMetadata, R> mappingFunction);
419424

src/test/java/org/springframework/data/r2dbc/function/AbstractDatabaseClientIntegrationTests.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515
*/
1616
package org.springframework.data.r2dbc.function;
1717

18+
import static org.assertj.core.api.Assertions.*;
19+
import static org.springframework.data.domain.Sort.Order.*;
20+
1821
import io.r2dbc.spi.ConnectionFactory;
1922
import lombok.Data;
23+
import reactor.core.publisher.Hooks;
24+
import reactor.test.StepVerifier;
25+
26+
import javax.sql.DataSource;
27+
2028
import org.junit.Before;
2129
import org.junit.Test;
2230
import org.springframework.dao.DataAccessException;
@@ -26,14 +34,6 @@
2634
import org.springframework.data.r2dbc.testing.R2dbcIntegrationTestSupport;
2735
import org.springframework.data.relational.core.mapping.Table;
2836
import org.springframework.jdbc.core.JdbcTemplate;
29-
import reactor.core.publisher.Flux;
30-
import reactor.core.publisher.Hooks;
31-
import reactor.test.StepVerifier;
32-
33-
import javax.sql.DataSource;
34-
35-
import static org.assertj.core.api.Assertions.*;
36-
import static org.springframework.data.domain.Sort.Order.*;
3737

3838
/**
3939
* Integration tests for {@link DatabaseClient}.
@@ -57,8 +57,7 @@ public void before() {
5757

5858
try {
5959
jdbc.execute("DROP TABLE legoset");
60-
} catch (DataAccessException e) {
61-
}
60+
} catch (DataAccessException e) {}
6261
jdbc.execute(getCreateTableStatement());
6362
}
6463

@@ -107,9 +106,6 @@ public void executeInsert() {
107106
.expectNext(1) //
108107
.verifyComplete();
109108

110-
Flux<LegoSet> rows = databaseClient.select().from("legoset").orderBy(Sort.by(desc("id"))).as(LegoSet.class).fetch()
111-
.all();
112-
113109
assertThat(jdbc.queryForMap("SELECT id, name, manual FROM legoset")).containsEntry("id", 42055);
114110
}
115111

0 commit comments

Comments
 (0)