Skip to content
Snippets Groups Projects
Commit 6d740464 authored by Colin DAMON's avatar Colin DAMON
Browse files

Convert five

parent 4c84e3b3
No related branches found
No related tags found
1 merge request!37Resolve "TCR Roman Numerals"
...@@ -3,6 +3,14 @@ package fr.ippon.kata.numeral; ...@@ -3,6 +3,14 @@ package fr.ippon.kata.numeral;
public class Numerals { public class Numerals {
public static String toRoman(int arabic) { public static String toRoman(int arabic) {
if (arabic == 5) {
return "V";
}
if (arabic == 4) {
return "IV";
}
return "I".repeat(arabic); return "I".repeat(arabic);
} }
} }
...@@ -20,4 +20,14 @@ class NumeralsTest { ...@@ -20,4 +20,14 @@ class NumeralsTest {
void shouldConvertTwoToII() { void shouldConvertTwoToII() {
assertThat(Numerals.toRoman(2)).isEqualTo("II"); assertThat(Numerals.toRoman(2)).isEqualTo("II");
} }
@Test
void shouldConvertFourToIV() {
assertThat(Numerals.toRoman(4)).isEqualTo("IV");
}
@Test
void shouldConvertFiveToV() {
assertThat(Numerals.toRoman(5)).isEqualTo("V");
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment