aa193b2b
Julien Iguchi-Cartigny
First version
|
1
2
|
package fr.plil.sio.web.mvc;
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
3
|
import org.junit.Test;
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
4
|
import org.junit.runner.RunWith;
|
88ff471f
Julien Cartigny
Switching to spri...
|
5
|
import org.springframework.boot.test.context.SpringBootTest;
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
6
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
7
|
import org.springframework.transaction.annotation.Transactional;
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
8
|
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
9
10
11
12
13
14
|
import javax.annotation.Resource;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
|
88ff471f
Julien Cartigny
Switching to spri...
|
15
|
@SpringBootTest(classes = Application.class)
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
16
|
@Transactional
|
8efec875
Julien Iguchi-Cartigny
switch to spring ...
|
17
|
public class UserRepositoryTest {
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
18
|
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
19
|
@Resource
|
8efec875
Julien Iguchi-Cartigny
switch to spring ...
|
20
|
private UserRepository userRepository;
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
21
|
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
22
23
|
@Test
public void testAdminPresent() {
|
2070653e
Julien Iguchi-Cartigny
Switching to spri...
|
24
25
26
|
assertEquals(1, userRepository.findAll().size());
assertNotNull(userRepository.findByUsername("admin"));
assertEquals("admin", userRepository.findByUsername("admin").getUsername());
|
aa193b2b
Julien Iguchi-Cartigny
First version
|
27
28
|
}
}
|