JAVA-20167 Remove methods that are not presented in articles

This commit is contained in:
timis1 2023-06-17 00:41:28 +03:00 committed by n
parent 80d7e13b3c
commit c76a1e8c45
2 changed files with 2 additions and 21 deletions

View File

@ -51,13 +51,6 @@ public interface UserRepository extends JpaRepository<User, Integer> {
List<User> findByAgeIn(Collection<Integer> ages);
@Query(value = "select * from users where (name = :nameParam OR birth_date <> :birthDateParam)", nativeQuery = true)
List<User> findByNameOrBirthDate(@Param(value = "nameParam") String nameParam, @Param(value = "birthDateParam") ZonedDateTime birthDateParam);
@Query(value = "select * from users where (name = :nameParam OR birth_date <> :birthDateParam) and active = :activeParam", nativeQuery = true)
List<User> findByNameOrBirthDateAndActive(@Param(value = "nameParam") String nameParam, @Param(value = "birthDateParam") ZonedDateTime birthDateParam,
@Param(value = "activeParam") Boolean activeParam);
List<User> findByNameOrAge(String name, Integer age);
List<User> findByNameOrAgeAndActive(String name, Integer age, Boolean active);

View File

@ -152,28 +152,16 @@ public class UserRepositoryIntegrationTest {
assertEquals(3, userRepository.findByAgeIn(ages).size());
}
@Test
public void whenByNameOrBirthDate() {
assertEquals(4, userRepository.findByNameOrBirthDate(USER_NAME_ADAM, BIRTHDATE).size());
}
@Test
public void whenByNameOrBirthDateAndActive() {
assertEquals(2, userRepository.findByNameOrBirthDateAndActive(USER_NAME_ADAM, BIRTHDATE, false).size());
}
@Test
public void whenByNameOrAge() {
assertEquals(2, userRepository.findByNameOrAge(USER_NAME_ADAM, 20).size());
assertEquals(3, userRepository.findByNameOrAge(USER_NAME_ADAM, 20).size());
}
@Test
public void whenByNameOrAgeAndActive() {
assertEquals(3, userRepository.findByNameOrAgeAndActive(USER_NAME_ADAM, 20, false).size());
assertEquals(2, userRepository.findByNameOrAgeAndActive(USER_NAME_ADAM, 20, false).size());
}
@Test