Skip to content
Snippets Groups Projects
Unverified Commit 0ed257a8 authored by khofmans's avatar khofmans
Browse files

refactor to string input for validatoin

parent bebd34fc
Branches
No related tags found
No related merge requests found
......@@ -4,9 +4,9 @@ import io.tripled.marsrover.Grids
import io.tripled.marsrover.domain.Grid
class CreateGrid(private val grids: Grids) {
fun create(gridSize: Int) {
fun create(gridSize: String) {
grids.save(Grid(gridSize))
grids.save(Grid(gridSize.toInt()))
}
}
......@@ -3,13 +3,14 @@ package io.tripled.marsrover
import io.tripled.marsrover.commands.CreateGrid
import io.tripled.marsrover.domain.Grid
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
internal class GridTests {
@Test
fun `creates a grid`() {
// given
val gridSize = 6
val gridSize = "6"
val grids = FakeGrids()
// when
......@@ -18,6 +19,20 @@ internal class GridTests {
// then
Assertions.assertEquals(grids.lastSaved.numberOfCoordinates, 36)
}
@Disabled
@Test
fun `input validation`() {
// given
val requestedGridSize = "6"
val grids = FakeGrids()
// when
CreateGrid(grids).create(requestedGridSize)
// then
Assertions.assertEquals(grids.lastSaved.numberOfCoordinates, 36)
}
}
class FakeGrids : Grids {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment