Sha256: 743a2441bcec953d16f49a356a74c4ed8003a31294c212ff70fb41dc5579e679

Contents?: true

Size: 873 Bytes

Versions: 307

Compression:

Stored size: 873 Bytes

Contents

import org.junit.Test
import org.junit.Ignore
import kotlin.test.assertNotEquals
import kotlin.test.assertTrue

class RobotTest {

    companion object {
        val EXPECTED_ROBOT_NAME_PATTERN = Regex("[A-Z]{2}\\d{3}")
        private fun isValidName(name: String) = EXPECTED_ROBOT_NAME_PATTERN.matches(name)
    }

    val robot = Robot()


    @Test
    fun hasName() {
        assertTrue(isValidName(robot.name), "Robot name ${robot.name} didn't match expected pattern.")
    }

    @Ignore
    @Test
    fun differentRobotsHaveDifferentNames() {
        assertNotEquals(robot.name, Robot().name)
    }

    @Ignore
    @Test
    fun resetName() {
        val name = robot.name
        robot.reset()

        val name2 = robot.name
        assertNotEquals(name, name2)
        assertTrue(isValidName(name2), "Robot name $name2 didn't match expected pattern.")
    }

}

Version data entries

307 entries across 307 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.179 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.178 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.177 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.176 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.175 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.174 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.173 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.172 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.171 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.170 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.169 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.167 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.166 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.165 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.164 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.163 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.162 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.161 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt
trackler-2.2.1.160 tracks/kotlin/exercises/robot-name/src/test/kotlin/RobotTest.kt