回答編集履歴
3
コメント追加
test
CHANGED
@@ -34,6 +34,8 @@
|
|
34
34
|
|
35
35
|
Arguments.of(100, 0, -1, ArithmeticException.class),
|
36
36
|
|
37
|
+
// 3番目のケースでは例外が起きないのでテスト失敗します
|
38
|
+
|
37
39
|
Arguments.of(100, 2, 50, ArithmeticException.class)
|
38
40
|
|
39
41
|
);
|
2
条件追加
test
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
tenpuさんの希望されているのはこんな感じでしょうか?
|
2
|
+
|
3
|
+
JUnit5での記述です。
|
2
4
|
|
3
5
|
|
4
6
|
|
1
文法修正
test
CHANGED
@@ -40,13 +40,11 @@
|
|
40
40
|
|
41
41
|
|
42
42
|
|
43
|
-
@SuppressWarnings("unchecked")
|
44
|
-
|
45
43
|
@ParameterizedTest(name = "{0} / {1} = {2}")
|
46
44
|
|
47
45
|
@MethodSource("multiArgumentsProvider")
|
48
46
|
|
49
|
-
void div(Integer first, Integer second, int expectedResult, Class expectedException) {
|
47
|
+
void div(Integer first, Integer second, int expectedResult, Class<Exception> expectedException) {
|
50
48
|
|
51
49
|
Assertions.assertThrows(expectedException, () -> {
|
52
50
|
|