-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathForkJoinProcessingTest.java
More file actions
33 lines (27 loc) · 1.02 KB
/
ForkJoinProcessingTest.java
File metadata and controls
33 lines (27 loc) · 1.02 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
package com.example.modernjava.chapter07;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@Slf4j
class ForkJoinProcessingTest {
@Nested
class ForkJoinSumCalculatorTest {
@BeforeEach
void setUp() {
}
@Test
void testForkJoinSum() {
final var result1 = ForkJoinProcessing.ForkJoinSumCalculator.forkJoinSum(100L);
assertEquals(5050L, result1);
log.info("Sum of Sequence: {}", result1);
final var result2 = ForkJoinProcessing.ForkJoinSumCalculator.forkJoinSum(10_000L);
assertEquals(50005000L, result2);
log.info("Sum of Sequence: {}", result2);
final var result3 = ForkJoinProcessing.ForkJoinSumCalculator.forkJoinSum(100_000L);
assertEquals(5000050000L, result3);
log.info("Sum of Sequence: {}", result3);
}
}
}