forked from pauldambra/JavaModulusChecker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModulusTenTests.java
More file actions
36 lines (29 loc) · 1.26 KB
/
ModulusTenTests.java
File metadata and controls
36 lines (29 loc) · 1.26 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
import com.github.pauldambra.moduluschecker.Account.BankAccount;
import com.github.pauldambra.moduluschecker.ModulusAlgorithm;
import com.github.pauldambra.moduluschecker.ModulusCheckParams;
import com.github.pauldambra.moduluschecker.chain.checks.ModulusTenCheck;
import com.github.pauldambra.moduluschecker.valacdosFile.WeightRow;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
public class ModulusTenTests {
@Test
public void CanRunModulusTenCheck() {
String sc = "089999";
String an = "66374958";
WeightRow row = new WeightRow(
ModulusAlgorithm.MOD10,
ImmutableList.of(0, 0, 0, 0, 0, 0, 7, 1, 3, 7, 1, 3, 7, 1),
Optional.empty()
);
ModulusCheckParams params = new ModulusCheckParams(
BankAccount.Of(sc, an),
Optional.of(row), Optional.empty(), Optional.empty());
ModulusTenCheck checker = new ModulusTenCheck();
Boolean result = checker.check(params, x -> x.firstWeightRow.get());
assertThat(result, is(equalTo(true)));
}
}