Skip to content

Commit

Permalink
Adjust the unit test (eugenp#6543)
Browse files Browse the repository at this point in the history
* Add the code for article "Kotlin Annotations" (BAEL-2579)

* Adjust the Validation test
  • Loading branch information
veontomo authored and maibin committed Mar 16, 2019
1 parent a9a7ae3 commit 6ad4766
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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")))
}


}

0 comments on commit 6ad4766

Please sign in to comment.