use of demo.domain.User in project microservices by pwillhan.
the class UserVehicleServiceTest method getVehicleDetailsShouldReturnMakeAndModel.
@Test
public void getVehicleDetailsShouldReturnMakeAndModel() throws Exception {
given(this.userRepository.findByUsername("donald")).willReturn(new User("donald", VIN));
VehicleDetails details = new VehicleDetails("Honda", "Civic");
given(this.vehicleDetailsService.getVehicleDetails(VIN)).willReturn(details);
VehicleDetails actual = this.service.getVehicleDetails("donald");
assertThat(actual).isEqualTo(details);
}
use of demo.domain.User in project microservices by pwillhan.
the class UserVehicleService method getVehicleDetails.
public VehicleDetails getVehicleDetails(String username) throws UserNameNotFoundException, VehicleIdentificationNumberNotFoundException {
Assert.notNull(username, "Username must not be null");
User user = this.userRepository.findByUsername(username);
if (user == null) {
throw new UserNameNotFoundException(username);
}
return this.vehicleDetailsService.getVehicleDetails(user.getVin());
}
Aggregations