Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 634 Bytes

File metadata and controls

38 lines (29 loc) · 634 Bytes

TestIntro

Dependencies

https://truth.dev/

    testImplementation "com.google.truth:truth:1.1.3"

Basic Test

import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test

class TestTax {

    private lateinit var tax: Tax

    @Before
    fun setup() {
        tax = Tax()
    }

    @Test
    fun calculateTaxTest() {
        val netTax = tax.calculateTax(100.0, 0.1)
        assertThat(netTax).isEqualTo(10)
    }

    @Test
    fun calculateIncomeTest() {
        val netIncome = tax.calculateIncome(100.0, 0.1)
        assertThat(netIncome).isEqualTo(90)
    }

}