use of sample.test.domain.User in project spring-boot by spring-projects.
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());
}
use of sample.test.domain.User in project spring-boot by spring-projects.
the class UserVehicleServiceTests method getVehicleDetailsShouldReturnMakeAndModel.
@Test
public void getVehicleDetailsShouldReturnMakeAndModel() throws Exception {
given(this.userRepository.findByUsername(anyString())).willReturn(new User("sboot", VIN));
VehicleDetails details = new VehicleDetails("Honda", "Civic");
given(this.vehicleDetailsService.getVehicleDetails(VIN)).willReturn(details);
VehicleDetails actual = this.service.getVehicleDetails("sboot");
assertThat(actual).isEqualTo(details);
}
Aggregations