Correct test class

Report a typo

We have a class Calculator, and in the class, we wrote a method divide().

class Calculator {

    fun divide(a: Int, b: Int): Int {
        return if (b == 0) 0 else a / b
    }
}

For testing our class, we also wrote a testing class CalculatorTest. Place the test class code correctly for the correct test class result.

Working experience of the tested class:

Working experience of the tested class

Reorder lines using drag or arrows. Adjust indentation with left buttons
                @CsvSource("2, 1, 2", "4, 2, 2", "1, 0, 0", "6, 2, 3")
              
                class CalculatorTest {
              
                assertEquals(expected, result)
              
                fun testDivide(first: Int, second: Int, expected: Int) {
              
                }
              
                }
              
                @ParameterizedTest
              
                val result = Calculator().divide(first, second)
              
___

Create a free account to access the full topic