-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/fix code coverage issue (#228)
* Fixed coverage issue * Fixed mockito version * Minor coverage updates & enabled back scala
- Loading branch information
1 parent
73401b9
commit b9b5e39
Showing
5 changed files
with
70 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/com/datastax/cdm/job/SplitPartitionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.datastax.cdm.job; | ||
|
||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.math.BigInteger; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class SplitPartitionsTest { | ||
|
||
@Test | ||
void getRandomSubPartitionsTest() { | ||
List<SplitPartitions.Partition> partitions = SplitPartitions.getRandomSubPartitions(10, BigInteger.ONE, | ||
BigInteger.valueOf(100), 100); | ||
assertEquals(10, partitions.size()); | ||
partitions.forEach(p -> { | ||
assertEquals(9, p.getMax().longValue() - p.getMin().longValue()); | ||
}); | ||
} | ||
|
||
@Test | ||
void getRandomSubPartitionsTestOver100() { | ||
List<SplitPartitions.Partition> partitions = SplitPartitions.getRandomSubPartitions(8, BigInteger.ONE, | ||
BigInteger.valueOf(44), 200); | ||
assertEquals(8, partitions.size()); | ||
} | ||
@Test | ||
void batchesTest() { | ||
List<String> mutable_list = Arrays.asList("e1", "e2", "e3", "e4", "e5", "e6"); | ||
Stream<List<String>> out = SplitPartitions.batches(mutable_list, 2); | ||
assertEquals(3, out.count()); | ||
} | ||
|
||
} |