BAEL - 2829

Fixed the compilation error
This commit is contained in:
TINO 2019-03-29 11:08:14 +03:00
parent 90eb4ba359
commit ee06fce6f8
2 changed files with 16 additions and 16 deletions

View File

@ -2,8 +2,8 @@ package com.baeldung.dao.repositories;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import com.baeldung.domain.Person; import com.baeldung.domain.Employee;
public interface PersonRepository extends JpaRepository<Person, Long> { public interface EmployeeRepository extends JpaRepository<Employee, Long> {
} }

View File

@ -8,32 +8,32 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.domain.Person; import com.baeldung.domain.Employee;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@DataJpaTest @DataJpaTest
public class PersonRepositoryIntegrationTest { public class EmployeeRepositoryIntegrationTest {
private static final Person PERSON1 = new Person(1L, "John", "Doe"); private static final Employee EMPLOYEE1 = new Employee(1L, "John");
private static final Person PERSON2 = new Person(2L, "Alice", "Bob"); private static final Employee EMPLOYEE2 = new Employee(2L, "Alice");
@Autowired @Autowired
private PersonRepository personRepository; private EmployeeRepository employeeRepository;
@Test @Test
public void givenPersonEntity_whenInsertWithSave_ThenPersonIsPersisted() { public void givenEmployeeEntity_whenInsertWithSave_ThenEmployeeIsPersisted() {
personRepository.save(PERSON1); employeeRepository.save(EMPLOYEE1);
assertPersonPersisted(PERSON1); assertEmployeePersisted(EMPLOYEE1);
} }
@Test @Test
public void givenPersonEntity_whenInsertWithSaveAndFlush_ThenPersonIsPersisted() { public void givenEmployeeEntity_whenInsertWithSaveAndFlush_ThenEmployeeIsPersisted() {
personRepository.saveAndFlush(PERSON2); employeeRepository.saveAndFlush(EMPLOYEE2);
assertPersonPersisted(PERSON2); assertEmployeePersisted(EMPLOYEE2);
} }
private void assertPersonPersisted(Person input) { private void assertEmployeePersisted(Employee input) {
Person person = personRepository.getOne(input.getId()); Employee employee = employeeRepository.getOne(input.getId());
assertThat(person).isNotNull(); assertThat(employee).isNotNull();
} }
} }