Testing IV
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 27 Nov 2016 17:27:34 +0000 (18:27 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 27 Nov 2016 17:27:34 +0000 (18:27 +0100)
We are in position of testing exceptions like IV.
Exceptions will be added to enum and our algorithm we will keep working.

TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java
TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java

index 4f7f40d..3460afe 100644 (file)
@@ -17,6 +17,7 @@ public class RomanNumeralGenerator {
        enum RomanToDecimal {
                TEN("X", 10),
                FIVE("V", 5),
+               FOUR("IV", 4),
                ONE("I", 1);
                
                private final String roman;
index 031280b..84139b6 100644 (file)
@@ -18,9 +18,7 @@ public class RomanNumeralsGeneratorShould {
                assertThat(romanFor(1), is("I"));
                assertThat(romanFor(2), is("II"));
                assertThat(romanFor(3), is("III"));
-               // We jump to five because IV is an exception, it is
-               // going to be more complicated and we do not already have
-               // the pattern to extract the algorithm for the IV number.
+               assertThat(romanFor(4), is("IV"));
                assertThat(romanFor(5), is("V"));
                assertThat(romanFor(7), is("VII"));
                assertThat(romanFor(10), is("X"));