forked from rbmonster/learning-note
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestNGSpringDemo.java
More file actions
29 lines (25 loc) · 1.03 KB
/
Copy pathTestNGSpringDemo.java
File metadata and controls
29 lines (25 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import com.four.unittest.UnitTestApplication;
import com.four.unittest.service.UnitTestService;
import lombok.extern.slf4j.Slf4j;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
@Slf4j
@ActiveProfiles(profiles = "test")
@SpringBootTest(classes = UnitTestApplication.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class TestNGSpringDemo extends AbstractTestNGSpringContextTests {
@Autowired
UnitTestService unitTestService;
@Test
public void test1() {
log.info("this is test1");
String s = unitTestService.testJdbcTemplate();
log.info("jdbc query result is : {}", s);
}
}