package testUnitaire.database.crud.alltest;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.sql.SQLException;

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

import testUnitaire.database.crud.testCrud;
import database.crud.ModePaiementCrud;
import database.dataset.Modedepaiement;

public class testCrudModeDePaiement extends testCrud<Modedepaiement> {

	@Override
	@Before
	public void init() throws SQLException {
		setCrud(new ModePaiementCrud(getConnection()));
		setDataset(new Modedepaiement(magicID, "credit"));
		setDataset2(new Modedepaiement(magicID+1, "credit"));
	}
	
	
	@Test
	public void testDeReadAllNotLike() throws SQLException{
		getCrud().update(getDataset());
		boolean ok=false;
		for (Modedepaiement a : ((ModePaiementCrud)getCrud()).readAllLike("rouble"))
			ok |= a.equals(getDataset());
		assertFalse("should fail",ok);
	}

	@Test
	public void testDeReadAllLike() throws SQLException{
		getCrud().update(getDataset());
		boolean ok=false;
		for (Modedepaiement a : ((ModePaiementCrud)getCrud()).readAllLike("credi"))
			ok |= a.equals(getDataset());
		assertTrue("read all like not work",ok);
	}
}
