a800fde0
jcartign
First version, in...
|
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
30
31
32
33
34
35
|
package fr.plil.sio.persistence.jdbc;
import fr.plil.sio.persistence.api.User;
import fr.plil.sio.persistence.api.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = JdbcApplication.class)
public class UserServiceTest {
@Autowired
private UserService userService;
@Test
public void testCreateAndFindByName() {
final String name = "blabla";
User user1 = userService.create(name);
User user2 = userService.findByName(name);
assertNotNull(user1);
assertNotNull(user2);
assertNotNull(user1.getName());
assertNotNull(user2.getName());
assertNotNull(user1.getGroup());
assertNotNull(user2.getGroup());
assertEquals(user1.getName(), user2.getName());
assertEquals(user1.getGroup(), user2.getGroup());
}
}
|