[BAEL-10234] - Move spring-rest-... modules to Boot 2
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package org.baeldung.client;
|
||||
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.web.client.TestRestTemplate;
|
||||
@@ -12,9 +14,8 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
public class TestRestTemplateBasicLiveTest {
|
||||
|
||||
@@ -39,7 +40,9 @@ public class TestRestTemplateBasicLiveTest {
|
||||
|
||||
@Test
|
||||
public void givenRestTemplateWrapper_whenSendGetForEntity_thenStatusOk() {
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate);
|
||||
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder();
|
||||
restTemplateBuilder.configure(restTemplate);
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder);
|
||||
ResponseEntity<String> response = testRestTemplate.getForEntity(FOO_RESOURCE_URL + "/1", String.class);
|
||||
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
|
||||
}
|
||||
@@ -55,7 +58,9 @@ public class TestRestTemplateBasicLiveTest {
|
||||
|
||||
@Test
|
||||
public void givenRestTemplateWrapperWithCredentials_whenSendGetForEntity_thenStatusOk() {
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplate, "user", "passwd");
|
||||
RestTemplateBuilder restTemplateBuilder = new RestTemplateBuilder().basicAuthentication("user", "passwd");
|
||||
restTemplateBuilder.configure(restTemplate);
|
||||
TestRestTemplate testRestTemplate = new TestRestTemplate(restTemplateBuilder);
|
||||
ResponseEntity<String> response = testRestTemplate.getForEntity(URL_SECURED_BY_AUTHENTICATION,
|
||||
String.class);
|
||||
assertThat(response.getStatusCode(), equalTo(HttpStatus.OK));
|
||||
|
||||
Reference in New Issue
Block a user