package v_builders.examples

import org.junit.Assert.assertEquals
import org.junit.Test
import java.util.*

class _38_The_Function_Apply {
    @Test fun testBuildString() {
        val expected = buildString()
        val actual = StringBuilder().apply {
            append("Numbers: ")
            for (i in 1..10) {
                append(i)
            }
        }.toString()
        assertEquals("String should be built:", expected, actual)
    }

    @Test fun testBuildMap() {
        val expected = buildMap()
        val actual = HashMap<Int, String>().apply {
            put(0, "0")
            for (i in 1..10) {
                put(i, "$i")
            }
        }
        assertEquals("Map should be filled with the right values", expected, actual)
    }
}

package v_builders.examples

import org.junit.Assert.assertEquals
import org.junit.Test
import java.util.*

class _38_The_Function_Apply {
    @Test fun testBuildString() {
        val expected = StringBuilder().apply {
            append("Numbers: ")
            for (i in 1..10) {
                append(i)
            }
        }.toString()
        val actual = buildString()
        assertEquals("String should be built:", expected, actual)
    }

    @Test fun testBuildMap() {
        val expected = HashMap<Int, String>().apply {
            put(0, "0")
            for (i in 1..10) {
                put(i, "$i")
            }
        }
        val actual = buildMap()
        assertEquals("Map should be filled with the right values", expected, actual)
    }
}

Fix inconsistent unit tests for 38 (The Function Apply) suite.
Fix inconsistent unit tests for 38 (The Function Apply) suite.

Reason: Expected and actual are mixed up.

Kotlin/kotlin-koans,wickedwukong/kotlin-koans,wickedwukong/kotlin-koans,Carighan/kotlin-koans,enchf/kotlin-koans,zyallday/kotlin-koans,Riccorl/kotlin-koans,TheCoinTosser/Kotlin-Koans---Solutions,Carighan/kotlin-koans,JetBrains/workshop-jb,Riccorl/kotlin-koans,JetBrains/workshop-jb,hughandrewarch/kotlin-koans,trmollet/tuto_kotlin,Kotlin/kotlin-koans,enchf/kotlin-koans,trmollet/tuto_kotlin,TheCoinTosser/Kotlin-Koans---Solutions,hughandrewarch/kotlin-koans,zyallday/kotlin-koans