forked from hacker85/JavaLessons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBootTest.java
More file actions
24 lines (23 loc) · 726 Bytes
/
Copy pathBootTest.java
File metadata and controls
24 lines (23 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import com.max.interfaces.MyComponent;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = BootTest.Config.class)
//@TestConfiguration
public class BootTest {
@Autowired
// @MockBean
MyComponent bean;
@Test
public void test() {
bean.print();
}
@SpringBootConfiguration
@ComponentScan("com.max")
static class Config {}
}