Sfoglia il codice sorgente

Update RomanNumberalsTest (#1309)

* Update RomanNumberalsTest

* Update tests
Lu Lechuan 8 anni fa
parent
commit
52b2ee7381
1 ha cambiato i file con 118 aggiunte e 37 eliminazioni
  1. 118
    37
      exercises/roman-numerals/src/test/java/RomanNumeralsTest.java

+ 118
- 37
exercises/roman-numerals/src/test/java/RomanNumeralsTest.java Vedi File

1
 import org.junit.Test;
1
 import org.junit.Test;
2
 import org.junit.Ignore;
2
 import org.junit.Ignore;
3
-import org.junit.runner.RunWith;
4
-import org.junit.runners.Parameterized;
5
-import org.junit.runners.Parameterized.Parameters;
6
-
7
-import java.util.Arrays;
8
-import java.util.Collection;
9
 
3
 
10
 import static org.junit.Assert.assertEquals;
4
 import static org.junit.Assert.assertEquals;
11
 
5
 
12
-@RunWith(Parameterized.class)
13
 public class RomanNumeralsTest {
6
 public class RomanNumeralsTest {
14
 
7
 
15
-    private int arabicNumeral;
16
-    private String romanNumeral;
8
+    private RomanNumeral romanNumeral;
9
+
10
+    @Test
11
+    public void test1ToRomanNumberI() {
12
+        romanNumeral = new RomanNumeral(1);
13
+        assertEquals("I", romanNumeral.getRomanNumeral());
14
+    }
15
+
16
+    @Ignore("Remove to run test")
17
+    @Test
18
+    public void test2ToRomanNumberII() {
19
+        romanNumeral = new RomanNumeral(2);
20
+        assertEquals("II", romanNumeral.getRomanNumeral());
21
+    }
22
+
23
+    @Ignore("Remove to run test")
24
+    @Test
25
+    public void test3ToRomanNumberIII() {
26
+        romanNumeral = new RomanNumeral(3);
27
+        assertEquals("III", romanNumeral.getRomanNumeral());
28
+    }
29
+
30
+    @Ignore("Remove to run test")
31
+    @Test
32
+    public void test4ToRomanNumberIV() {
33
+        romanNumeral = new RomanNumeral(4);
34
+        assertEquals("IV", romanNumeral.getRomanNumeral());
35
+    }
36
+
37
+    @Ignore("Remove to run test")
38
+    @Test
39
+    public void test5ToRomanNumberV() {
40
+        romanNumeral = new RomanNumeral(5);
41
+        assertEquals("V", romanNumeral.getRomanNumeral());
42
+    }
17
 
43
 
18
-    @Parameters(name = "{index}: expected arabic numeral {0} to be converted to roman numeral \"{1}\".")
19
-    public static Collection<Object[]> data() {
20
-        return Arrays.asList(new Object[][]{
21
-                {1, "I"},
22
-                {2, "II"},
23
-                {3, "III"},
24
-                {4, "IV"},
25
-                {5, "V"},
26
-                {6, "VI"},
27
-                {9, "IX"},
28
-                {27, "XXVII"},
29
-                {48, "XLVIII"},
30
-                {59, "LIX"},
31
-                {93, "XCIII"},
32
-                {141, "CXLI"},
33
-                {163, "CLXIII"},
34
-                {402, "CDII"},
35
-                {575, "DLXXV"},
36
-                {911, "CMXI"},
37
-                {1024, "MXXIV"},
38
-                {3000, "MMM"}
39
-        });
44
+    @Ignore("Remove to run test")
45
+    @Test
46
+    public void test6ToRomanNumberVI() {
47
+        romanNumeral = new RomanNumeral(6);
48
+        assertEquals("VI", romanNumeral.getRomanNumeral());
40
     }
49
     }
41
 
50
 
42
-    public RomanNumeralsTest(int arabicNumeral, String romanNumeral) {
43
-        this.arabicNumeral = arabicNumeral;
44
-        this.romanNumeral = romanNumeral;
51
+    @Ignore("Remove to run test")
52
+    @Test
53
+    public void test9ToRomanNumberIX() {
54
+        romanNumeral = new RomanNumeral(9);
55
+        assertEquals("IX", romanNumeral.getRomanNumeral());
45
     }
56
     }
46
 
57
 
58
+    @Ignore("Remove to run test")
59
+    @Test
60
+    public void test27ToRomanNumberXXVII() {
61
+        romanNumeral = new RomanNumeral(27);
62
+        assertEquals("XXVII", romanNumeral.getRomanNumeral());
63
+    }
47
 
64
 
65
+    @Ignore("Remove to run test")
48
     @Test
66
     @Test
49
-    public void convertArabicNumberalToRomanNumeral() {
50
-        RomanNumeral romanNumeral = new RomanNumeral(arabicNumeral);
67
+    public void test48ToRomanNumberXLVIII() {
68
+        romanNumeral = new RomanNumeral(48);
69
+        assertEquals("XLVIII", romanNumeral.getRomanNumeral());
70
+    }
51
 
71
 
52
-        assertEquals(this.romanNumeral, romanNumeral.getRomanNumeral());
72
+    @Ignore("Remove to run test")
73
+    @Test
74
+    public void test59ToRomanNumberLIX() {
75
+        romanNumeral = new RomanNumeral(59);
76
+        assertEquals("LIX", romanNumeral.getRomanNumeral());
53
     }
77
     }
78
+
79
+    @Ignore("Remove to run test")
80
+    @Test
81
+    public void test93ToRomanNumberXCIII() {
82
+        romanNumeral = new RomanNumeral(93);
83
+        assertEquals("XCIII", romanNumeral.getRomanNumeral());
84
+    }
85
+
86
+    @Ignore("Remove to run test")
87
+    @Test
88
+    public void test141ToRomanNumberCXLI() {
89
+        romanNumeral = new RomanNumeral(141);
90
+        assertEquals("CXLI", romanNumeral.getRomanNumeral());
91
+    }
92
+
93
+    @Ignore("Remove to run test")
94
+    @Test
95
+    public void test163ToRomanNumberCLXIII() {
96
+        romanNumeral = new RomanNumeral(163);
97
+        assertEquals("CLXIII", romanNumeral.getRomanNumeral());
98
+    }
99
+
100
+    @Ignore("Remove to run test")
101
+    @Test
102
+    public void test402ToRomanNumberCDII() {
103
+        romanNumeral = new RomanNumeral(402);
104
+        assertEquals("CDII", romanNumeral.getRomanNumeral());
105
+    }
106
+
107
+    @Ignore("Remove to run test")
108
+    @Test
109
+    public void test575ToRomanNumberDLXXV() {
110
+        romanNumeral = new RomanNumeral(575);
111
+        assertEquals("DLXXV", romanNumeral.getRomanNumeral());
112
+    }
113
+
114
+    @Ignore("Remove to run test")
115
+    @Test
116
+    public void test911ToRomanNumberCMXI() {
117
+        romanNumeral = new RomanNumeral(911);
118
+        assertEquals("CMXI", romanNumeral.getRomanNumeral());
119
+    }
120
+
121
+    @Ignore("Remove to run test")
122
+    @Test
123
+    public void test1024ToRomanNumberMXXIV() {
124
+        romanNumeral = new RomanNumeral(1024);
125
+        assertEquals("MXXIV", romanNumeral.getRomanNumeral());
126
+    }
127
+
128
+    @Ignore("Remove to run test")
129
+    @Test
130
+    public void test3000ToRomanNumberMMM() {
131
+        romanNumeral = new RomanNumeral(1024);
132
+        assertEquals("MXXIV", romanNumeral.getRomanNumeral());
133
+    }
134
+
54
 }
135
 }