Skip to content

Commit 5573995

Browse files
committed
Warnings and test bug
1 parent 3904878 commit 5573995

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/main/java/org/dataloader/DataLoader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
* @author <a href="https://github.com/aschrijver/">Arnold Schrijver</a>
6060
* @author <a href="https://github.com/bbakerman/">Brad Baker</a>
6161
*/
62-
@SuppressWarnings("UnusedReturnValue")
6362
@PublicApi
6463
public class DataLoader<K, V> {
6564

src/test/java/org/dataloader/DataLoaderIfPresentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.concurrent.CompletableFuture;
77
import java.util.concurrent.CompletionStage;
88

9-
import static org.dataloader.DataLoaderFactory.*;
9+
import static org.dataloader.DataLoaderFactory.newDataLoader;
1010
import static org.hamcrest.Matchers.equalTo;
1111
import static org.hamcrest.Matchers.sameInstance;
1212
import static org.junit.Assert.assertThat;

src/test/java/org/dataloader/DataLoaderRegistryTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public void registration_works() {
3737
assertThat(registry.getDataLoaders(), equalTo(asList(dlA, dlB, dlC)));
3838

3939

40-
// and unregister
41-
DataLoaderRegistry dlUnregistered = registry.unregister("c");
40+
// and unregister (fluently)
41+
DataLoaderRegistry dlR = registry.unregister("c");
42+
assertThat(dlR,equalTo(registry));
4243

43-
assertThat(dlUnregistered,equalTo(dlC));
4444
assertThat(registry.getDataLoaders(), equalTo(asList(dlA, dlB)));
4545

4646
// look up by name works

src/test/java/org/dataloader/DataLoaderTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
import static java.util.Collections.emptyList;
3636
import static java.util.Collections.singletonList;
3737
import static org.awaitility.Awaitility.await;
38-
import static org.dataloader.DataLoaderFactory.*;
38+
import static org.dataloader.DataLoaderFactory.newDataLoader;
3939
import static org.dataloader.DataLoaderOptions.newOptions;
4040
import static org.dataloader.TestKit.listFrom;
4141
import static org.dataloader.impl.CompletableFutureKit.cause;
@@ -244,7 +244,9 @@ public void should_Clear_single_value_in_loader() throws ExecutionException, Int
244244
assertThat(future2.get(), equalTo("B"));
245245
assertThat(loadCalls, equalTo(singletonList(asList("A", "B"))));
246246

247-
identityLoader.clear("A");
247+
// fluency
248+
DataLoader<String, String> dl = identityLoader.clear("A");
249+
assertThat(dl, equalTo(identityLoader));
248250

249251
CompletableFuture<String> future1a = identityLoader.load("A");
250252
CompletableFuture<String> future2a = identityLoader.load("B");
@@ -270,7 +272,8 @@ public void should_Clear_all_values_in_loader() throws ExecutionException, Inter
270272
assertThat(future2.get(), equalTo("B"));
271273
assertThat(loadCalls, equalTo(singletonList(asList("A", "B"))));
272274

273-
identityLoader.clearAll();
275+
DataLoader<String, String> dlFluent = identityLoader.clearAll();
276+
assertThat(dlFluent, equalTo(identityLoader)); // fluency
274277

275278
CompletableFuture<String> future1a = identityLoader.load("A");
276279
CompletableFuture<String> future2a = identityLoader.load("B");
@@ -287,7 +290,8 @@ public void should_Allow_priming_the_cache() throws ExecutionException, Interrup
287290
List<Collection<String>> loadCalls = new ArrayList<>();
288291
DataLoader<String, String> identityLoader = idLoader(new DataLoaderOptions(), loadCalls);
289292

290-
identityLoader.prime("A", "A");
293+
DataLoader<String, String> dlFluency = identityLoader.prime("A", "A");
294+
assertThat(dlFluency, equalTo(identityLoader));
291295

292296
CompletableFuture<String> future1 = identityLoader.load("A");
293297
CompletableFuture<String> future2 = identityLoader.load("B");

0 commit comments

Comments
 (0)