From 13fe844be8ce2bffa2d0ba5aa6922c6b659c45cb Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 27 Nov 2016 17:52:15 +0100 Subject: [PATCH] Writing test for X --- .../main/java/org/craftedsw/romannumerals/RomanNumeralGenerator.java | 4 ++++ .../org/craftedsw/romannumerals/RomanNumeralsGeneratorShould.java | 1 + 2 files changed, 5 insertions(+) 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 17bc8f3..72ea173 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 @@ -4,6 +4,10 @@ public class RomanNumeralGenerator { public static String romanFor(int decimal) { String roman = ""; + if (decimal == 10) { + roman += "X"; + decimal -= 10; + } if (decimal >= 5) { roman += "V"; decimal -= 5; 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 ed9e0d8..41d250b 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 @@ -23,6 +23,7 @@ public class RomanNumeralsGeneratorShould { // the pattern to extract the algorithm for the IV number. assertThat(romanFor(5), is("V")); assertThat(romanFor(7), is("VII")); + assertThat(romanFor(10), is("X")); } } -- 2.1.4