Search in sources :

Example 1 with User

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);
}
Also used : User(demo.domain.User) VehicleDetails(demo.service.VehicleDetails) Test(org.junit.Test)

Example 2 with User

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());
}
Also used : User(demo.domain.User)

Aggregations

User (demo.domain.User)2 VehicleDetails (demo.service.VehicleDetails)1 Test (org.junit.Test)1