package com.cadastrocliente.repositories;
import com.cadastrocliente.models.Cliente; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @DataJpaTest public class ClienteRepositoryTest {
@Autowired
private ClienteRepository clienteRepositoryTest;
@Test
public void deveriaCarregarUmCursoAoBuscarPeloSeuNome() {
String nomeCliente= "Evandro Gaio";
Cliente cliente= clienteRepositoryTest.findByNomeCompleto(nomeCliente);
Assert.assertNotNull(cliente);
Assert.assertEquals(nomeCliente, cliente.getNomeCompleto());
} }