Missing method

Report a typo

Look at the test class for the online store cart:

class CartTest {

    @Test
    fun testGetTotalPrice() {
        val product1 = mockk<Product>()
        val product2 = mockk<Product>()

       ... { product1.price } returns 10.0
       ... { product2.price } returns 20.0

        val cart = Cart(listOf(product1, product2))
        val expectedTotalPrice = 30.0
        val actualTotalPrice = cart.getTotalPrice()

        assertEquals(expectedTotalPrice, actualTotalPrice, 0.0)
    }
}

We missed one of the methods; look at ... – which method is missing?

Enter a short text
___

Create a free account to access the full topic