source: extensions/jiwigo/trunk/src/test/java/fr/mael/jiwigo/service/CategoryServiceTest.java @ 6963

Last change on this file since 6963 was 6963, checked in by mlg, 14 years ago

Add unit tests :
New unit tests for the services :

  • CategoryServiceTest that tests the listing of the categories and the creation of a category
  • ServicesTest that tests the listing of the categories, then the listing of images of a category and finally adding a comment to an image.

Add informations in the install.txt file to explain how to build the executable jar file via maven (this allows to execute the tests before building, and does not build if tests fail).

File size: 787 bytes
Line 
1package fr.mael.jiwigo.service;
2
3import java.io.IOException;
4import java.util.Date;
5
6import junit.framework.Assert;
7
8import org.junit.Test;
9
10import fr.mael.jiwigo.TestBase;
11import fr.mael.jiwigo.dao.CategoryDao;
12
13public class CategoryServiceTest extends TestBase {
14    public CategoryServiceTest() {
15        super();
16    }
17
18    /**
19     *  Test of the listing method
20     */
21    @Test
22    public void ListerTest() {
23        try {
24            CategoryDao.getInstance().lister(true);
25            CategoryDao.getInstance().lister(false);
26        } catch (IOException e) {
27            e.printStackTrace();
28        }
29    }
30
31    /**
32     * Test of the creation method
33     */
34    @Test
35    public void creerTest() {
36        Date date = new Date();
37        Assert.assertSame(true, CategoryService.getInstance().creer("Category" + date.getTime()));
38    }
39
40}
Note: See TracBrowser for help on using the repository browser.