package testUnitaire.database.crud.alltest;

import static org.junit.Assert.*;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.SQLException;

import org.junit.Before;
import org.junit.Test;

import testUnitaire.database.crud.testCrud;
import database.crud.TaxeCrud;
import database.dataset.Taxe;

public class testCrudTaxe extends testCrud<Taxe> {

	@Override
	@Before
	public void init() throws SQLException {
		setCrud(new TaxeCrud(getConnection()));
		setDataset(new Taxe(magicID, new BigDecimal("0.075"), new BigDecimal("0.05"), new BigDecimal("3.00"), Date.valueOf("2013-04-04")));
		setDataset2(new Taxe(magicID+1, new BigDecimal("0.075"), new BigDecimal("0.05"), new BigDecimal("3.00"), Date.valueOf("2013-04-04")));
	}
	
	@Test
	public void testReadLast() throws SQLException{
		getCrud().update(getDataset());
		assertTrue("probleme avec la derniere taxe",((TaxeCrud)getCrud()).readLast().equals(getDataset()));
	}
}