RegistrationService
validates the following rules:
RegistrationService
should call the database to determine whether a user ID exists or not. We'll create a data access interface for persisting user and to check whether a duplicate user ID is present. Perform the following steps to build the service, create a data access object API, and unit test the service:
Create a
RegistrationDao
interface in thecom.packt.dao
package, and add the following methods to check for duplicate users and to create a new user:public interface RegistrationDao { boolean isExistingUserId(String userId); void create(String userId, String password, String firstName, String lastName); }
Modify the
RegistrationService
...