source: extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/service/ServicesTest.java @ 9921

Last change on this file since 9921 was 9921, checked in by mlg, 13 years ago

Adds spring for the dependency injection
Deletion of jdom (not useful just for a class that manipulates a simple XML file)

File size: 1.0 KB
Line 
1package fr.mael.jiwigo.service;
2
3import java.util.List;
4
5import org.junit.Test;
6
7import fr.mael.jiwigo.TestBase;
8import fr.mael.jiwigo.om.Category;
9import fr.mael.jiwigo.om.Comment;
10import fr.mael.jiwigo.om.Image;
11import fr.mael.jiwigo.transverse.util.spring.SpringUtils;
12
13public class ServicesTest extends TestBase {
14
15    public ServicesTest() {
16        super();
17    }
18
19    @Test
20    public void testCreer() throws Exception {
21        Category cat = null;
22        for (Category category : SpringUtils.getCategoryService().list(true)) {
23            if (category.getIdentifier().equals(3)) {
24                cat = category;
25                break;
26            }
27        }
28
29        Image image = SpringUtils.getImageService().listByCategory(cat.getIdentifier(), true).get(0);
30        List<Comment> comments = SpringUtils.getCommentService().list(image.getIdentifier());
31        //      int firstCount = comments.size();
32        SpringUtils.getCommentService().create("comment test", image.getIdentifier(), "none");
33        //      int secondCount = CommentService.getInstance(Main.sessionManager).list(image.getIdentifier()).size();
34        //      Assert.assertSame(firstCount + 1, secondCount);
35    }
36}
Note: See TracBrowser for help on using the repository browser.