BAEL-554 - Logging Spring Web Request

This commit is contained in:
slavisa-baeldung 2017-07-25 15:42:57 +01:00
parent 34dc48c2e5
commit 7fdab0e191
1 changed files with 8 additions and 8 deletions

View File

@ -13,21 +13,21 @@ import com.baeldung.web.log.data.TaxiRide;
public class TestTaxiFareController {
private static final String URL = "http://localhost:" + 8082 + "/spring-rest/taxifare/";
@Test
public void givenRequest_thenfetchTaxiFareRateCard() {
public void givenRequest_whenFetchTaxiFareRateCard_thanOK() {
TestRestTemplate testRestTemplate = new TestRestTemplate();
ResponseEntity<String> response = testRestTemplate.getForEntity(URL + "get/", String.class);
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
}
@Test
public void givenTaxiRide_thenGetCalculatedFare() {
public void givenTaxiRide_whenCalculatedFare_thanStatus200() {
TestRestTemplate testRestTemplate = new TestRestTemplate();
TaxiRide taxiRide = new TaxiRide(true,10l);
String fare = testRestTemplate.postForObject(URL + "calculate/", taxiRide,String.class);
TaxiRide taxiRide = new TaxiRide(true, 10l);
String fare = testRestTemplate.postForObject(URL + "calculate/", taxiRide, String.class);
assertThat(fare, equalTo("200"));
}
}