From 8deea428346e3e1fb267832f8d6f98fc5b6938b8 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 27 Nov 2016 18:27:34 +0100 Subject: [PATCH] Testing IV We are in position of testing exceptions like IV. Exceptions will be added to enum and our algorithm we will keep working. --- .../main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java | 1 + .../org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java b/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java index 4f7f40d..3460afe 100644 --- a/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java +++ b/TDD/sandromancuso/romannumerals/src/main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java @@ -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; diff --git a/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java b/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java index 031280b..84139b6 100644 --- a/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java +++ b/TDD/sandromancuso/romannumerals/src/test/java/org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java @@ -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")); -- 2.1.4