File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
src/test/java/problems/impl Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
package problems .impl ;
2
2
3
+ import java .util .ArrayList ;
4
+ import java .util .Arrays ;
5
+ import java .util .List ;
6
+
3
7
import org .junit .Assert ;
4
8
import org .junit .Test ;
5
9
6
10
import problems .interfaces .ISBNValidator ;
11
+ import problems .interfaces .InverseMultiplierListProductSumGenerator ;
7
12
8
13
public class ISBNValidatorImplTest {
9
- private final ISBNValidator isbnValidator = new ISBNValidatorImpl ();
14
+ private final List <Integer > testValues1 = new ArrayList <>(Arrays .asList (1 ));
15
+ private final InverseMultiplierListProductSumGenerator inverseMultiplierListProductSumGenerator = new InverseMultiplierListProductSumGenerator () {
16
+ @ Override public long generateInverseMultiplierListProductSum (final List <Integer > values ) {
17
+ if (values == testValues1 ) {
18
+ return 11 ;
19
+ } else {
20
+ return 10 ;
21
+ }
22
+ }
23
+ };
24
+ private final ISBNValidator isbnValidator = new ISBNValidatorImpl (inverseMultiplierListProductSumGenerator );
10
25
11
26
@ Test
12
27
public void testValidateISBN () {
@@ -24,7 +39,8 @@ public void testValidateISBN() {
24
39
// expected
25
40
}
26
41
27
- Assert .assertFalse (isbnValidator .validateISBN (1000000000 ));
42
+ Assert .assertFalse (isbnValidator .validateISBN (1 ));
43
+ Assert .assertTrue (isbnValidator .validateISBN (2 ));
28
44
}
29
45
30
46
}
You can’t perform that action at this time.
0 commit comments