-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathTestDataLoaderFactory.java
More file actions
46 lines (32 loc) · 1.62 KB
/
TestDataLoaderFactory.java
File metadata and controls
46 lines (32 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package org.dataloader.fixtures.parameterized;
import org.dataloader.DataLoader;
import org.dataloader.DataLoaderOptions;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public interface TestDataLoaderFactory {
<K> DataLoader<K, K> idLoader(DataLoaderOptions options, List<Collection<K>> loadCalls);
<K> DataLoader<K, K> idLoaderDelayed(DataLoaderOptions options, List<Collection<K>> loadCalls, Duration delay);
<K> DataLoader<K, K> idLoaderBlowsUps(DataLoaderOptions options, List<Collection<K>> loadCalls);
<K> DataLoader<K, Object> idLoaderAllExceptions(DataLoaderOptions options, List<Collection<K>> loadCalls);
DataLoader<Integer, Object> idLoaderOddEvenExceptions(DataLoaderOptions options, List<Collection<Integer>> loadCalls);
DataLoader<String, String> onlyReturnsNValues(int N, DataLoaderOptions options, ArrayList<Object> loadCalls);
DataLoader<String, String> idLoaderReturnsTooMany(int howManyMore, DataLoaderOptions options, ArrayList<Object> loadCalls);
// Convenience methods
default <K> DataLoader<K, K> idLoader(DataLoaderOptions options) {
return idLoader(options, new ArrayList<>());
}
default <K> DataLoader<K, K> idLoader(List<Collection<K>> calls) {
return idLoader(null, calls);
}
default <K> DataLoader<K, K> idLoader() {
return idLoader(null, new ArrayList<>());
}
default <K> DataLoader<K, K> idLoaderDelayed(Duration delay) {
return idLoaderDelayed(null, new ArrayList<>(), delay);
}
default TestDataLoaderFactory unwrap() {
return this;
}
}