use of sample.test.service.VehicleDetails in project spring-boot by spring-projects.
the class UserVehicleControllerSeleniumTests method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("sboot")).willReturn(new VehicleDetails("Honda", "Civic"));
this.webDriver.get("/sboot/vehicle.html");
WebElement element = this.webDriver.findElement(By.tagName("h1"));
assertThat(element.getText()).isEqualTo("Honda Civic");
}
use of sample.test.service.VehicleDetails in project spring-boot by spring-projects.
the class UserVehicleControllerTests method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("sboot")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/sboot/vehicle").accept(MediaType.TEXT_PLAIN)).andExpect(status().isOk()).andExpect(content().string("Honda Civic"));
}
use of sample.test.service.VehicleDetails in project spring-boot by spring-projects.
the class UserVehicleControllerTests method getVehicleWhenRequestingHtmlShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingHtmlShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("sboot")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/sboot/vehicle.html").accept(MediaType.TEXT_HTML)).andExpect(status().isOk()).andExpect(content().string(containsString("<h1>Honda Civic</h1>")));
}
use of sample.test.service.VehicleDetails 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);
}
use of sample.test.service.VehicleDetails in project spring-boot by spring-projects.
the class UserVehicleControllerApplicationTests method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("sboot")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/sboot/vehicle").accept(MediaType.TEXT_PLAIN)).andExpect(status().isOk()).andExpect(content().string("Honda Civic"));
}
Aggregations