瀏覽代碼

contextLoadTest

Seth 5 年之前
父節點
當前提交
7cfe1a3efd

+ 2
- 0
src/main/java/io/zipcoder/crudapp/PersonRepository.java 查看文件

@@ -1,6 +1,8 @@
1 1
 package io.zipcoder.crudapp;
2 2
 
3 3
 import org.springframework.data.repository.CrudRepository;
4
+import org.springframework.stereotype.Repository;
4 5
 
6
+@Repository
5 7
 public interface PersonRepository extends CrudRepository<Person, Integer> {
6 8
 }

+ 6
- 0
src/test/java/io/zipcoder/crudapp/CRUDApplicationTests.java 查看文件

@@ -1,7 +1,9 @@
1 1
 package io.zipcoder.crudapp;
2 2
 
3
+import org.junit.Assert;
3 4
 import org.junit.Test;
4 5
 import org.junit.runner.RunWith;
6
+import org.springframework.beans.factory.annotation.Autowired;
5 7
 import org.springframework.boot.test.context.SpringBootTest;
6 8
 import org.springframework.test.context.junit4.SpringRunner;
7 9
 
@@ -9,8 +11,12 @@ import org.springframework.test.context.junit4.SpringRunner;
9 11
 @SpringBootTest
10 12
 public class CRUDApplicationTests {
11 13
 
14
+	@Autowired
15
+	PersonController personController;
16
+
12 17
 	@Test
13 18
 	public void contextLoads() {
19
+		Assert.assertNotNull(personController);
14 20
 	}
15 21
 
16 22
 }