Unit testing the service layer
RegistrationService
validates the following rules:
- The user ID, password, first name, or last name cannot be empty
- The first and last names cannot contain numbers
- The first and last names cannot contain special characters
- The password should contain at least one special character
- There cannot be a duplicate user ID
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 ...
Get Mockito for Spring now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.