Author: echatellier Date: 2012-04-18 11:14:13 +0200 (Wed, 18 Apr 2012) New Revision: 3378 Url: http://chorem.org/repositories/revision/lima/3378 Log: Add test about just created empty entry book Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-18 08:42:09 UTC (rev 3377) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2012-04-18 09:14:13 UTC (rev 3378) @@ -29,7 +29,6 @@ import org.chorem.lima.entity.EntryBookImpl; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import java.text.ParseException; @@ -52,21 +51,6 @@ } /** - * Permet de tester l'ajout d'un journal dans la base de données. - * (erreur duplication). - * - * @throws LimaException - */ - @Test(expected=LimaException.class) - @Ignore - public void createJournalTest() throws LimaException { - EntryBook entryBook = new EntryBookImpl(); - entryBook.setLabel(JOURNAL_DES_VENTES); - entryBook.setCode("jdv"); - entryBookService.createEntryBook(entryBook); - } - - /** * Permet de tester la modification d'un journal suivant son préfixe. * * @throws LimaException @@ -86,4 +70,31 @@ Assert.assertEquals("Journal des achats", entryBook.getLabel()); } + /** + * Test que la suppression d'un journal utilisé n'est pas possible. + * + * @throws LimaException + */ + @Test(expected=LimaBusinessException.class) + public void deleteUsedEntryBook() throws LimaException { + EntryBook entryBook = entryBookService.getAllEntryBooks().get(0); // VTE + Assert.assertNotNull(entryBook); + entryBookService.removeEntryBook(entryBook); + } + + /** + * Un journal tout juste créé doit pouvoir être supprimé. + * + * @throws LimaException + */ + @Test + public void deleteNonUsedEntryBookTest() throws LimaException { + EntryBook myEntryBook = new EntryBookImpl(); + myEntryBook.setCode("JRN"); + myEntryBook.setLabel("MyJournal"); + myEntryBook = entryBookService.createEntryBook(myEntryBook); + entryBookService.removeEntryBook(myEntryBook); + + Assert.assertEquals(1, entryBookService.getAllEntryBooks().size()); + } } \ No newline at end of file