Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
twitch
live-coding-fr
Commits
6d740464
Commit
6d740464
authored
Nov 24, 2020
by
Colin DAMON
Browse files
Convert five
parent
4c84e3b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
tcr-roman-numerals/src/main/java/fr/ippon/kata/numeral/Numerals.java
View file @
6d740464
...
...
@@ -3,6 +3,14 @@ package fr.ippon.kata.numeral;
public
class
Numerals
{
public
static
String
toRoman
(
int
arabic
)
{
if
(
arabic
==
5
)
{
return
"V"
;
}
if
(
arabic
==
4
)
{
return
"IV"
;
}
return
"I"
.
repeat
(
arabic
);
}
}
tcr-roman-numerals/src/test/java/fr/ippon/kata/numeral/NumeralsTest.java
View file @
6d740464
...
...
@@ -20,4 +20,14 @@ class NumeralsTest {
void
shouldConvertTwoToII
()
{
assertThat
(
Numerals
.
toRoman
(
2
)).
isEqualTo
(
"II"
);
}
@Test
void
shouldConvertFourToIV
()
{
assertThat
(
Numerals
.
toRoman
(
4
)).
isEqualTo
(
"IV"
);
}
@Test
void
shouldConvertFiveToV
()
{
assertThat
(
Numerals
.
toRoman
(
5
)).
isEqualTo
(
"V"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment