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.TelephoneTypeCrud;
import database.dataset.TelephoneType;

public class testCrudTelephoneType extends testCrud<TelephoneType> {

	@Override
	@Before
	public void init() throws SQLException {
		setCrud(new TelephoneTypeCrud(getConnection()));
		setDataset(new TelephoneType(magicID, "cellulaire"));
		setDataset2(new TelephoneType(magicID+1, "cellulaire"));
	}
	
	@Test
	public void testDeReadAllNotLike() throws SQLException{
		getCrud().update(getDataset());
		boolean ok=false;
		for (TelephoneType a : ((TelephoneTypeCrud)getCrud()).readAllLike("signaux de fumé"))
			ok |= a.equals(getDataset());
		assertFalse("should fail",ok);
	}

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