Adjust the unit test (#6543)

* Add the code for article "Kotlin Annotations" (BAEL-2579)

* Adjust the Validation test
This commit is contained in:
Andrey Shcherbakov 2019-03-16 15:50:04 +01:00 committed by maibin
parent a9a7ae3c26
commit 6ad4766776
1 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,41 @@
package com.baeldung.annotations
import org.junit.Test
import kotlin.test.assertTrue
import kotlin.test.assertFalse
class ValidationUnitTest {
@Test
fun whenAmountIsOneAndNameIsAlice_thenTrue() {
assertTrue(Validator().isValid(Item(1f, "Alice")))
}
@Test
fun whenAmountIsOneAndNameIsBob_thenTrue() {
assertTrue(Validator().isValid(Item(1f, "Bob")))
}
@Test
fun whenAmountIsMinusOneAndNameIsAlice_thenFalse() {
assertFalse(Validator().isValid(Item(-1f, "Alice")))
}
@Test
fun whenAmountIsMinusOneAndNameIsBob_thenFalse() {
assertFalse(Validator().isValid(Item(-1f, "Bob")))
}
@Test
fun whenAmountIsOneAndNameIsTom_thenFalse() {
assertFalse(Validator().isValid(Item(1f, "Tom")))
}
@Test
fun whenAmountIsMinusOneAndNameIsTom_thenFalse() {
assertFalse(Validator().isValid(Item(-1f, "Tom")))
}
}