質問編集履歴
1
スタックトレース追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,19 +40,13 @@
|
|
40
40
|
|
41
41
|
```java
|
42
42
|
|
43
|
-
@Mocked
|
44
|
-
|
45
|
-
PreparedStatement ps;
|
46
|
-
|
47
|
-
|
48
|
-
|
49
43
|
@Test
|
50
44
|
|
51
45
|
public void test001() {
|
52
46
|
|
53
47
|
@Test
|
54
48
|
|
55
|
-
public void test001() throws SQLException {
|
49
|
+
public void test001(@Mocked PreparedStatement ps) throws SQLException {
|
56
50
|
|
57
51
|
|
58
52
|
|
@@ -76,6 +70,44 @@
|
|
76
70
|
|
77
71
|
```
|
78
72
|
|
73
|
+
上記コードで実行すると下記のようなスタックとレースが出ます。
|
74
|
+
|
75
|
+
```console
|
76
|
+
|
77
|
+
mockit.internal.MissingInvocation: Missing 1 invocation to:
|
78
|
+
|
79
|
+
java.sql.PreparedStatement#executeUpdate()
|
80
|
+
|
81
|
+
on mock instance: $Impl_PreparedStatement@174d20a
|
82
|
+
|
83
|
+
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
|
84
|
+
|
85
|
+
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
|
86
|
+
|
87
|
+
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
|
88
|
+
|
89
|
+
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
|
90
|
+
|
91
|
+
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
|
92
|
+
|
93
|
+
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
|
94
|
+
|
95
|
+
Caused by: Missing invocations
|
96
|
+
|
97
|
+
at jp.co.zurich.sevenps.test.SevenpsLogDAOTest$1.<init>(SevenpsLogDAOTest.java:52)
|
98
|
+
|
99
|
+
at jp.co.zurich.sevenps.test.SevenpsLogDAOTest.test001(SevenpsLogDAOTest.java:50)
|
100
|
+
|
101
|
+
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
102
|
+
|
103
|
+
at java.lang.reflect.Method.invoke(Method.java:498)
|
104
|
+
|
105
|
+
... 6 more
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
```
|
110
|
+
|
79
111
|
Expectations()で挙動を登録しているつもりなのですが、正規のルートが走ってしまい、期待した値が得られません。
|
80
112
|
|
81
113
|
staticメソッドの中身をモック化は出来ないのでしょうか?
|