Author: echatellier Date: 2012-02-22 17:49:09 +0100 (Wed, 22 Feb 2012) New Revision: 3345 Url: http://chorem.org/repositories/revision/lima/3345 Log: Add test about Ledger account Added: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-02-22 15:32:20 UTC (rev 3344) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/ImportServiceImplTest.java 2012-02-22 16:49:09 UTC (rev 3345) @@ -30,6 +30,7 @@ import java.text.ParseException; import org.apache.commons.io.IOUtils; +import org.chorem.lima.entity.Account; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodImpl; import org.junit.Assert; @@ -55,6 +56,8 @@ */ protected void importEBPData() throws IOException, LimaException, ParseException { + clearService.clearDatabase(); + // create fiscal period (mandatory for import) FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); fiscalPeriod.setBeginDate(df.parse("January 1, 2012")); @@ -105,4 +108,32 @@ Assert.assertNotNull(accountService.getAccountByNumber("401TEEMP")); Assert.assertNotNull(accountService.getAccountByNumber("411TECLI")); } + + /** + * Test que les comptes tiers sont correctement rattachés à l'arbre du + * plan comptable. + * + * @throws Exception + */ + @Test + public void testImportAccountLedgerAccount() throws Exception { + importEBPData(); + + Account compteTiers = accountService.getAccountByNumber("4"); + Account employeAccount = accountService.getAccountByNumber("401TEEMP"); + Assert.assertEquals(compteTiers, employeAccount.getGeneralLedger()); + } + + /** + * Do some test on imported accounts. + * + * @throws Exception + */ + @Test + public void testImportEntryBookEBP() throws Exception { + importEBPData(); + + Assert.assertNotNull(entryBookService.getEntryBookByCode("EV")); + Assert.assertNotNull(entryBookService.getEntryBookByCode("BQ")); + } } Added: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java =================================================================== --- trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java (rev 0) +++ trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java 2012-02-22 16:49:09 UTC (rev 3345) @@ -0,0 +1,60 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +package org.chorem.lima.business.accountingrules; + +import org.chorem.lima.business.ImportServiceImplTest; +import org.chorem.lima.business.LimaConfig; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Add configuration to add specific test on French rules set. + * + * (redo all test defined in ImportServiceImplTest). + * + * Plus ajout de test specific à la locale FR. + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ + * By : $Author$ + */ +public class ImportServiceRuleFrTest extends ImportServiceImplTest { + + @BeforeClass + public static void installFrenchRule() throws Exception { + LimaConfig.getInstance().setAccountingRule(FranceAccountingRules.class.getName()); + } + + /** + * Test une fois que la regles est correctement instanciée car + * elle peut être mise en cache dans {@link LimaConfig}. + */ + @Test + public void testRuleInstance() { + Assert.assertTrue(LimaConfig.getInstance().getAccountingRules() instanceof FranceAccountingRules); + } +} Property changes on: trunk/lima-business/src/test/java/org/chorem/lima/business/accountingrules/ImportServiceRuleFrTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL