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.StatusChambreCrud;
import database.dataset.Status_chambre;

public class testCrudStatus extends testCrud<Status_chambre> {

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

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