Selaa lähdekoodia

contextLoadTest

Seth 6 vuotta sitten
vanhempi
commit
7cfe1a3efd

+ 2
- 0
src/main/java/io/zipcoder/crudapp/PersonRepository.java Näytä tiedosto

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

+ 6
- 0
src/test/java/io/zipcoder/crudapp/CRUDApplicationTests.java Näytä tiedosto

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