質問編集履歴
7
画像修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,12 +76,10 @@
|
|
76
76
|
|
77
77
|
```
|
78
78
|
|
79
|
+
![イメージ説明](1a0afc0764776eeff410af9d9ffe2660.png)
|
79
80
|
|
81
|
+
![イメージ説明](0f37669ad293a798e81178ebd766a527.png)
|
80
82
|
|
81
|
-
![イメージ説明](
|
83
|
+
![イメージ説明](31580d3a7a2ba20a9508f70fc04e9f58.png)
|
82
84
|
|
83
|
-
![イメージ説明](
|
85
|
+
![イメージ説明](6dd3fdbc208b1f367a752890e720e62e.png)
|
84
|
-
|
85
|
-
![イメージ説明](abc95d83a2346aa64f62a6e0ac0f48bc.png)
|
86
|
-
|
87
|
-
![イメージ説明](8fbd6a365bb3c7cb34f5e4b7f9f62472.png)
|
6
コード編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,11 +34,9 @@
|
|
34
34
|
|
35
35
|
@SpringBootTest
|
36
36
|
|
37
|
-
@Configuration
|
37
|
+
//@ContextConfiguration(locations="classpath:springmvc-config/context.xml")
|
38
38
|
|
39
|
-
|
39
|
+
@ContextConfiguration
|
40
|
-
|
41
|
-
@ContextConfiguration("file:src/main/resources/springmvc-config/context.xml")
|
42
40
|
|
43
41
|
@TestExecutionListeners({
|
44
42
|
|
@@ -62,18 +60,6 @@
|
|
62
60
|
|
63
61
|
public void testSelectAll() throws Exception {
|
64
62
|
|
65
|
-
// List<Item> itemList = itemRepository.selectAll();
|
66
|
-
|
67
|
-
// for (Item item : itemList) {
|
68
|
-
|
69
|
-
// System.out.println(item);
|
70
|
-
|
71
|
-
// }
|
72
|
-
|
73
|
-
// assertEquals(itemList.size(), 2);
|
74
|
-
|
75
|
-
|
76
|
-
|
77
63
|
int count = itemRepository.count();
|
78
64
|
|
79
65
|
assertEquals(count, 2);
|
@@ -81,6 +67,8 @@
|
|
81
67
|
}
|
82
68
|
|
83
69
|
}
|
70
|
+
|
71
|
+
|
84
72
|
|
85
73
|
|
86
74
|
|
5
コード編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,9 +40,17 @@
|
|
40
40
|
|
41
41
|
@ContextConfiguration("file:src/main/resources/springmvc-config/context.xml")
|
42
42
|
|
43
|
+
@TestExecutionListeners({
|
44
|
+
|
45
|
+
DependencyInjectionTestExecutionListener.class,
|
46
|
+
|
47
|
+
DbUnitTestExecutionListener.class
|
48
|
+
|
49
|
+
})
|
50
|
+
|
43
51
|
public class ItemRepositorySelectAllTest {
|
44
52
|
|
45
|
-
@
|
53
|
+
@Inject
|
46
54
|
|
47
55
|
ItemRepository itemRepository;
|
48
56
|
|
@@ -50,17 +58,31 @@
|
|
50
58
|
|
51
59
|
@Test
|
52
60
|
|
53
|
-
@S
|
61
|
+
@DatabaseSetup("/dbunit/itemTest.xml")
|
54
62
|
|
55
63
|
public void testSelectAll() throws Exception {
|
56
64
|
|
65
|
+
// List<Item> itemList = itemRepository.selectAll();
|
66
|
+
|
67
|
+
// for (Item item : itemList) {
|
68
|
+
|
69
|
+
// System.out.println(item);
|
70
|
+
|
71
|
+
// }
|
72
|
+
|
73
|
+
// assertEquals(itemList.size(), 2);
|
74
|
+
|
75
|
+
|
76
|
+
|
57
|
-
int count=itemRepository.count();
|
77
|
+
int count = itemRepository.count();
|
58
78
|
|
59
79
|
assertEquals(count, 2);
|
60
80
|
|
61
81
|
}
|
62
82
|
|
63
83
|
}
|
84
|
+
|
85
|
+
|
64
86
|
|
65
87
|
|
66
88
|
|
4
タイトル修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
【JUnit(Springboot使用)】Mybatisを使用したテストクラスの書き方について
|
test
CHANGED
File without changes
|
3
本文修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
【JUnit(Springboot使用)】Mybatisを使用したテストクラスの書き方について
|
1
|
+
ほ【JUnit(Springboot使用)】Mybatisを使用したテストクラスの書き方について
|
test
CHANGED
@@ -9,6 +9,8 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
context.xmlは、src/main/resources/springmvc-configにあります。
|
12
|
+
|
13
|
+
ItemRepositoryはインターフェースです。
|
12
14
|
|
13
15
|
|
14
16
|
|
2
本文編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Springbootで、Mybatisを使用してDBからデータを取得できるかどうかのテストをしようと思い、JUnitを勉強しています。
|
1
|
+
Springboot(SpringMVC)で、Mybatisを使用してDBからデータを取得できるかどうかのテストをしようと思い、JUnitを勉強しています。
|
2
2
|
|
3
3
|
|
4
4
|
|
1
本文編集
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
テストクラスは、src/test/javaの直下にパッケージを作成して書いています。
|
6
6
|
|
7
|
-
ネットで色々調べて書いてはみたのですが、以下のエラーから抜け出す事が出来ません。
|
7
|
+
ネットで色々調べて書いてはみた(特にアノテーション部分)のですが、以下のエラーから抜け出す事が出来ません。
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
@Test
|
50
50
|
|
51
|
-
@Sql({ "/sql/item_delete.sql", "/sql/em
|
51
|
+
@Sql({ "/sql/item_delete.sql", "/sql/item_insert.sql" })
|
52
52
|
|
53
53
|
public void testSelectAll() throws Exception {
|
54
54
|
|