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

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

All services have been removed from this project to be integrated in a new project : jiwigo-ws-api (not yet on the svn).
The current project now uses jiwigo-ws-api as a maven dependency (explanations can be found here : http://www.jiwigo.com/api.html )

File size: 1.0 KB
Line 
1package fr.mael.jiwigo.service;
2
3import junit.framework.Assert;
4
5import org.junit.Test;
6
7import fr.mael.jiwigo.Main;
8import fr.mael.jiwigo.TestBase;
9import fr.mael.jiwigo.om.Category;
10import fr.mael.jiwigo.om.Image;
11
12public class ServicesTest extends TestBase {
13
14    public ServicesTest() {
15        super();
16    }
17
18    @Test
19    public void testCreer() throws Exception {
20        Category cat = null;
21        for (Category category : CategoryService.getInstance(Main.sessionManager).lister(true)) {
22            if (category.getIdentifiant().equals(3)) {
23                cat = category;
24                break;
25            }
26        }
27        Image image = ImageService.getInstance(Main.sessionManager).listerParCategory(cat.getIdentifiant(), true)
28                .get(0);
29        int firstCount = CommentService.getInstance(Main.sessionManager).lister(image.getIdentifiant()).size();
30        CommentService.getInstance(Main.sessionManager).creer("comment test", image.getIdentifiant(), "none");
31        Assert.assertSame(firstCount + 1, CommentService.getInstance(Main.sessionManager)
32                .lister(image.getIdentifiant()).size());
33    }
34}
Note: See TracBrowser for help on using the repository browser.