0
I need to know how to implement registration deletion through Junit(Unit Tests) with Spring Boot, I’m having difficulty, the inclusion is working as you can see below;
@Autowired
private PessoaRepository pessoaRepository;
@Autowired
private PessoaService pessoaService;
@Test
public void testAdicionarPessoa() throws Exception {
Pessoa pessoa1 = new Pessoa("Douglas", "399.536.640-64");
this.pessoaService.salvar(pessoa1);
// Assertions.assertThat(pessoa1.getName()).isNotNull();
}
I tried to delete the record this way, but I was unsuccessful.
@Test
public void testeDeletePessoa() throws Exception {
Pessoa pessoa2 = new Pessoa();
this.pessoaRepository.delete((long) 4);
}
I accept suggestions and am open to questions
Trying to enter the code generated this error;
Hello, an error message has appeared, if yes, report the error, which makes it easier to find the solution.
– Marciano Machado
Hi, all good? I just updated my post, could you please take a look?
– wladyband
Are you using that database ?
– Marciano Machado
I’m yes, it’s the Postgres database.
– wladyband