Java tutorial
/** * This file is part of impotch/calcul. * * impotch/calcul 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. * * impotch/calcul 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 impotch/calcul. If not, see <http://www.gnu.org/licenses/>. */ package org.impotch.calcul.impot.cantonal.ge.pp; import static org.junit.Assert.assertEquals; import java.math.BigDecimal; import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.impotch.bareme.Bareme; import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/beansCH_GE.xml", "/beansAssurancesSociales.xml" }) @TestExecutionListeners(DependencyInjectionTestExecutionListener.class) public class BaremeFortune2011Test { @Resource(name = "fournisseurRegleImpotCantonalGE") private FournisseurRegleImpotCantonalGE fournisseur; @Test public void baremeSource() { Bareme bareme = fournisseur.getBaremeFortune(2011); assertEquals("Pour 1000000 francs", new BigDecimal("2994.50"), bareme.calcul(new BigDecimal("1000000"))); bareme = fournisseur.getBaremeFortuneSupplementaire(2011); assertEquals("Pour 1000000 francs", new BigDecimal("310.70"), bareme.calcul(new BigDecimal("1000000"))); } }