Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mars-rover
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Triple D
mars-rover
Commits
0ed257a8
Unverified
Commit
0ed257a8
authored
3 years ago
by
khofmans
Browse files
Options
Downloads
Patches
Plain Diff
refactor to string input for validatoin
parent
bebd34fc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/io/tripled/marsrover/commands/CreateGrid.kt
+2
-2
2 additions, 2 deletions
src/main/java/io/tripled/marsrover/commands/CreateGrid.kt
src/test/java/io/tripled/marsrover/GridTests.kt
+16
-1
16 additions, 1 deletion
src/test/java/io/tripled/marsrover/GridTests.kt
with
18 additions
and
3 deletions
src/main/java/io/tripled/marsrover/commands/CreateGrid.kt
+
2
−
2
View file @
0ed257a8
...
...
@@ -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
()
))
}
}
This diff is collapsed.
Click to expand it.
src/test/java/io/tripled/marsrover/GridTests.kt
+
16
−
1
View file @
0ed257a8
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment