1
- package com .didispace ;
2
-
3
- import com .didispace .domain .User ;
4
- import com .didispace .domain .UserMapper ;
5
- import org .junit .Assert ;
6
- import org .junit .Before ;
7
- import org .junit .Test ;
8
- import org .junit .runner .RunWith ;
9
- import org .springframework .beans .factory .annotation .Autowired ;
10
- import org .springframework .boot .test .SpringApplicationConfiguration ;
11
- import org .springframework .test .annotation .Rollback ;
12
- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
13
-
14
-
15
- @ RunWith (SpringJUnit4ClassRunner .class )
16
- @ SpringApplicationConfiguration (classes = Application .class )
17
- public class ApplicationTests {
18
-
19
- @ Autowired
20
- private UserMapper userMapper ;
21
-
22
- @ Test
23
- @ Rollback
24
- public void findByName () throws Exception {
25
- userMapper .insert ("AAA" , 20 );
26
- User u = userMapper .findByName ("AAA" );
27
- Assert .assertEquals (20 , u .getAge ().intValue ());
28
- }
29
-
30
- }
1
+ package com .didispace ;
2
+
3
+ import com .didispace .domain .User ;
4
+ import com .didispace .domain .UserMapper ;
5
+ import org .junit .Assert ;
6
+ import org .junit .Before ;
7
+ import org .junit .Test ;
8
+ import org .junit .runner .RunWith ;
9
+ import org .springframework .beans .factory .annotation .Autowired ;
10
+ import org .springframework .boot .test .SpringApplicationConfiguration ;
11
+ import org .springframework .test .annotation .Rollback ;
12
+ import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
13
+
14
+
15
+ @ RunWith (SpringJUnit4ClassRunner .class )
16
+ @ SpringApplicationConfiguration (classes = Application .class )
17
+ @ Transactional
18
+ public class ApplicationTests {
19
+
20
+ @ Autowired
21
+ private UserMapper userMapper ;
22
+
23
+ @ Test
24
+ @ Rollback
25
+ public void findByName () throws Exception {
26
+ userMapper .insert ("AAA" , 20 );
27
+ User u = userMapper .findByName ("AAA" );
28
+ Assert .assertEquals (20 , u .getAge ().intValue ());
29
+ }
30
+
31
+ }
0 commit comments