Skip to content

Commit 6ad4766

Browse files
veontomomaibin
authored andcommitted
Adjust the unit test (eugenp#6543)
* Add the code for article "Kotlin Annotations" (BAEL-2579) * Adjust the Validation test
1 parent a9a7ae3 commit 6ad4766

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.baeldung.annotations
2+
3+
import org.junit.Test
4+
import kotlin.test.assertTrue
5+
import kotlin.test.assertFalse
6+
7+
class ValidationUnitTest {
8+
9+
@Test
10+
fun whenAmountIsOneAndNameIsAlice_thenTrue() {
11+
assertTrue(Validator().isValid(Item(1f, "Alice")))
12+
}
13+
14+
@Test
15+
fun whenAmountIsOneAndNameIsBob_thenTrue() {
16+
assertTrue(Validator().isValid(Item(1f, "Bob")))
17+
}
18+
19+
20+
@Test
21+
fun whenAmountIsMinusOneAndNameIsAlice_thenFalse() {
22+
assertFalse(Validator().isValid(Item(-1f, "Alice")))
23+
}
24+
25+
@Test
26+
fun whenAmountIsMinusOneAndNameIsBob_thenFalse() {
27+
assertFalse(Validator().isValid(Item(-1f, "Bob")))
28+
}
29+
30+
@Test
31+
fun whenAmountIsOneAndNameIsTom_thenFalse() {
32+
assertFalse(Validator().isValid(Item(1f, "Tom")))
33+
}
34+
35+
@Test
36+
fun whenAmountIsMinusOneAndNameIsTom_thenFalse() {
37+
assertFalse(Validator().isValid(Item(-1f, "Tom")))
38+
}
39+
40+
41+
}

0 commit comments

Comments
 (0)