Build optimization 26.09.2017 (#2676)
* Optimize spring-rest * Refactor RxJava * Refactor RxJava
This commit is contained in:
committed by
GitHub
parent
c9a754f0e4
commit
d10d758c84
+1
-1
@@ -21,7 +21,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = MainApplication.class)
|
||||
public class ExamplePostControllerRequestUnitTest {
|
||||
public class ExamplePostControllerRequestIntegrationTest {
|
||||
|
||||
MockMvc mockMvc;
|
||||
@Mock private ExampleService exampleService;
|
||||
+1
-1
@@ -23,7 +23,7 @@ import org.baeldung.config.MainApplication;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = MainApplication.class)
|
||||
public class ExamplePostControllerResponseUnitTest {
|
||||
public class ExamplePostControllerResponseIntegrationTest {
|
||||
|
||||
MockMvc mockMvc;
|
||||
@Mock private ExampleService exampleService;
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.baeldung.web.log.test;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
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_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_whenCalculatedFare_thanStatus200() {
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate();
|
||||
TaxiRide taxiRide = new TaxiRide(true, 10l);
|
||||
String fare = testRestTemplate.postForObject(URL + "calculate/", taxiRide, String.class);
|
||||
|
||||
assertThat(fare, equalTo("200"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user