Skip to content

Commit

Permalink
fix CffuTest
Browse files Browse the repository at this point in the history
  • Loading branch information
huhaosumail committed Jun 26, 2024
1 parent 42f8ab4 commit 6335348
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cffu-core/src/test/java/io/foldright/cffu/CffuTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,23 @@ void test_thenMApply() throws Exception {
Cffu<Void>[] cfs = new Cffu[]{
completed.thenMApplyFastFailAsync(completed, function_n, function_n),
completed.thenMApplyFastFailAsync(completed, executorService, function_n, function_n),
completed.thenMApplyMostSuccessAsync(completed, 100, 100, TimeUnit.MILLISECONDS, function_n, function_n),
completed.thenMApplyMostSuccessAsync(completed, 100, executorService, 100, TimeUnit.MILLISECONDS, function_n, function_n),
completed.thenMApplyMostSuccessAsync(completed, 100, 500, TimeUnit.MILLISECONDS, function_n, function_n),
completed.thenMApplyMostSuccessAsync(completed, 100, executorService, 500, TimeUnit.MILLISECONDS, function_n, function_n),
completed.thenMApplyAsync(completed, function_n, function_n),
completed.thenMApplyAsync(completed, executorService, function_n, function_n)
};

assertTrue(System.currentTimeMillis() - tick < 50);
for (Cffu<Void> cf : cfs) {
assertNull(cf.get());
assertEquals(Arrays.asList(n, n), cf.get());
}
}

@Test
void test_thenMAccept() throws Exception {
final Cffu<Integer> completed = cffuFactory.completedFuture(n);
final Consumer<Integer> consumer = (s) -> {
final Consumer<Integer> consumer = (x) -> {
assertEquals(n, x);
sleep(100);
};

Expand All @@ -92,7 +93,7 @@ void test_thenMAccept() throws Exception {

@Test
void test_thenMRun() throws Exception {
final Cffu<Integer> completed = cffuFactory.completedFuture(n);
final Cffu<Integer> completed = cffuFactory.completedFuture(null);
final Runnable runnable = () -> {
sleep(100);
};
Expand All @@ -109,7 +110,7 @@ void test_thenMRun() throws Exception {

assertTrue(System.currentTimeMillis() - tick < 50);
for (Cffu<List<Integer>> cf : cfs) {
assertEquals(Arrays.asList(n, n), cf.get());
assertNull(cf.get());
}
}
////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 6335348

Please sign in to comment.