BAEL-6110: Fix Spring Data JPA Exception: No Property Found for Type (#13753)

This commit is contained in:
Azhwani
2023-04-16 18:32:18 +02:00
committed by GitHub
parent 8b674cd074
commit 737430655c
9 changed files with 136 additions and 1 deletions
@@ -0,0 +1,28 @@
package com.baeldung.nopropertyfound;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import com.baeldung.nopropertyfound.model.Person;
import com.baeldung.nopropertyfound.repository.PersonRepository;
@DataJpaTest
class PersonRepositoryIntegrationTest {
@Autowired
private PersonRepository personRepository;
@Test
void givenQueryMethod_whenUsingValidProperty_thenCorrect() {
Person person = personRepository.findByFirstName("Azhrioun");
assertNotNull(person);
assertEquals("Abderrahim", person.getLastName());
}
}