Skip to content

Instantly share code, notes, and snippets.

@aysesenses
Created September 28, 2021 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aysesenses/a5ece10721f14aac1baa67f4e5ccf410 to your computer and use it in GitHub Desktop.
Save aysesenses/a5ece10721f14aac1baa67f4e5ccf410 to your computer and use it in GitHub Desktop.
import junit.framework.Assert.assertEquals
import org.junit.Before
import org.junit.Test
class CalculatorTest {
private lateinit var calculator: Calculator
@Before
fun setUp() {
calculator = Calculator()
}
@Test
fun `the expected value in addition is equal to the true value`() {
assertEquals(6.0, calculator.sum(1.0, 5.0))
}
@Test
fun `the expected value in subtraction is equal to the true value`() {
assertEquals(6.0, calculator.subtract(10.0, 4.0))
}
@Test
fun `the expected value in division is equal to the true value`() {
assertEquals(2.0, calculator.divide(10.0, 5.0))
}
@Test
fun `the expected value in multiplication is equal to the true value` () {
assertEquals(20.0,calculator.multiply(2.0,10.0))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment