use of demo.service.VehicleDetails in project microservices by pwillhan.
the class UserVehicleControllerApplicationTest method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("donald")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/donald/vehicle").accept(MediaType.TEXT_PLAIN)).andExpect(status().isOk()).andExpect(content().string("Honda Civic"));
}
use of demo.service.VehicleDetails in project microservices by pwillhan.
the class UserVehicleControllerSeleniumTest method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("donald")).willReturn(new VehicleDetails("Honda", "Civic"));
this.webDriver.get("/donald/vehicle.html");
WebElement element = this.webDriver.findElement(By.tagName("h1"));
assertThat(element.getText()).isEqualTo("Honda Civic");
}
use of demo.service.VehicleDetails in project microservices by pwillhan.
the class UserVehicleControllerTest method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("donald")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/donald/vehicle").accept(MediaType.TEXT_PLAIN)).andExpect(status().isOk()).andExpect(content().string("Honda Civic"));
}
use of demo.service.VehicleDetails in project microservices by pwillhan.
the class UserVehicleControllerHtmlUnitTest method getVehicleWhenRequestingTextShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingTextShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("donald")).willReturn(new VehicleDetails("Honda", "Civic"));
HtmlPage page = this.webClient.getPage("/donald/vehicle.html");
assertThat(page.getBody().getTextContent()).isEqualTo("Honda Civic");
}
use of demo.service.VehicleDetails in project microservices by pwillhan.
the class UserVehicleControllerTest method getVehicleWhenRequestingJsonShouldReturnMakeAndModel.
@Test
public void getVehicleWhenRequestingJsonShouldReturnMakeAndModel() throws Exception {
given(this.userVehicleService.getVehicleDetails("donald")).willReturn(new VehicleDetails("Honda", "Civic"));
this.mvc.perform(get("/donald/vehicle").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(content().json("{'make':'Honda','model':'Civic'}"));
}
Aggregations