1 | package fr.mael.jiwigo.service; |
---|
2 | |
---|
3 | import java.util.Date; |
---|
4 | |
---|
5 | import junit.framework.Assert; |
---|
6 | |
---|
7 | import org.junit.Before; |
---|
8 | import org.junit.Test; |
---|
9 | |
---|
10 | import fr.mael.jiwigo.dao.impl.CategoryDaoImpl; |
---|
11 | import fr.mael.jiwigo.service.impl.CategoryServiceImpl; |
---|
12 | import fr.mael.jiwigo.transverse.exception.JiwigoException; |
---|
13 | import fr.mael.jiwigo.transverse.exception.ProxyAuthenticationException; |
---|
14 | import fr.mael.jiwigo.transverse.session.SessionManager; |
---|
15 | import fr.mael.jiwigo.transverse.session.impl.SessionManagerImpl; |
---|
16 | |
---|
17 | public class CategoryServiceTest { |
---|
18 | private SessionManager sessionManager; |
---|
19 | |
---|
20 | @Before |
---|
21 | public void setUp() throws JiwigoException { |
---|
22 | sessionManager = new SessionManagerImpl("mael", "motdepasse", "http://mael.piwigo.com", "Unit Test"); |
---|
23 | sessionManager.processLogin(); |
---|
24 | } |
---|
25 | |
---|
26 | /** |
---|
27 | * Test of the list method |
---|
28 | * |
---|
29 | * @throws ProxyAuthenticationException |
---|
30 | */ |
---|
31 | @Test |
---|
32 | public void ListerTest() throws JiwigoException { |
---|
33 | CategoryDaoImpl categaryDao = new CategoryDaoImpl(); |
---|
34 | categaryDao.setSessionManager(sessionManager); |
---|
35 | categaryDao.list(true); |
---|
36 | categaryDao.list(false); |
---|
37 | } |
---|
38 | |
---|
39 | /** |
---|
40 | * Test of the creation method |
---|
41 | * |
---|
42 | * @throws ProxyAuthenticationException |
---|
43 | */ |
---|
44 | @Test |
---|
45 | public void creerTest() throws JiwigoException { |
---|
46 | Date date = new Date(); |
---|
47 | CategoryServiceImpl categoryService = new CategoryServiceImpl(); |
---|
48 | CategoryDaoImpl dao = new CategoryDaoImpl(); |
---|
49 | dao.setSessionManager(sessionManager); |
---|
50 | categoryService.setDao(dao); |
---|
51 | Assert.assertSame(true, categoryService.create("Category" + date.getTime())); |
---|
52 | } |
---|
53 | |
---|
54 | } |
---|