| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import org.junit.Test;
- import org.junit.Ignore;
- import org.junit.runner.RunWith;
- import org.junit.runners.Parameterized;
- import org.junit.runners.Parameterized.Parameters;
-
- import java.util.Arrays;
- import java.util.Collection;
-
- import static org.junit.Assert.assertEquals;
-
- @RunWith(Parameterized.class)
- public class RomanNumeralsTest {
-
- private int arabicNumeral;
- private String romanNumeral;
-
- @Parameters(name = "{index}: expected arabic numeral {0} to be converted to roman numeral \"{1}\".")
- public static Collection<Object[]> data() {
- return Arrays.asList(new Object[][]{
- {1, "I"},
- {2, "II"},
- {3, "III"},
- {4, "IV"},
- {5, "V"},
- {6, "VI"},
- {9, "IX"},
- {27, "XXVII"},
- {48, "XLVIII"},
- {59, "LIX"},
- {93, "XCIII"},
- {141, "CXLI"},
- {163, "CLXIII"},
- {402, "CDII"},
- {575, "DLXXV"},
- {911, "CMXI"},
- {1024, "MXXIV"},
- {3000, "MMM"}
- });
- }
-
- public RomanNumeralsTest(int arabicNumeral, String romanNumeral) {
- this.arabicNumeral = arabicNumeral;
- this.romanNumeral = romanNumeral;
- }
-
-
- @Test
- public void convertArabicNumberalToRomanNumeral() {
- RomanNumeral romanNumeral = new RomanNumeral(arabicNumeral);
-
- assertEquals(this.romanNumeral, romanNumeral.getRomanNumeral());
- }
- }
|