Reputation: 127
I have interface like this:
public List<Event> findByUseNameAndStartDateBefore(String name, Date startDate);
if I make call like this:
userService.findByUseNameAndStartDateBefore(name, date);
it's working fine, but if call is without some argument:
userService.findByUseNameAndStartDateBefore(name);
[Assertion failed] - this argument is required; it must not be null
Questin is: how can I make some parameters not required? (data in this case)
Upvotes: 1
Views: 1055
Reputation: 44515
Create a method
public List<Event> findByUseName(String name);
A method named findByUseNameAndStartDateBefore without using the parameters one would assume according to the method name makes no sense and is against clean code rules (which also will affect the ability to understand the code for other developers).
Upvotes: 1