package agilpizza.modelo;

import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertSame;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import agilpizza.modelo.pizza.Endereco;
import agilpizza.modelo.pizza.EnderecoClienteDAO;

public class EnderecoClienteDAOTest {
	private static EnderecoClienteDAO dao;

	@BeforeClass
	public static void setUp() {
		dao = EnderecoClienteDAO.getInstanciaUnica();
		dao.setEndereco(new Endereco("Rua K", "123", "", "Pinheiros",
				"05445-445", "8765-4321"));
	}

	@AfterClass
	public static void tearDown() {
	}

	@Test
	public void testeInstanciaUnica() {
		EnderecoClienteDAO dao2 = EnderecoClienteDAO.getInstanciaUnica();
		assertSame("Devem ser o mesmo objeto.", dao, dao2);
	}

	@Test
	public void testeClienteExistente() {
		assertNotNull(dao.getEndereco("8765-4321"));
	}

	@Test
	public void testeClienteInexistente() {
		assertNull(dao.getEndereco("4330-4349"));
	}
}
