Skip to content

Commit

Permalink
add spring boot dependency, RestTemplate samples
Browse files Browse the repository at this point in the history
  • Loading branch information
javajigi committed May 27, 2020
1 parent d218380 commit c7c9f4e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2'
testImplementation 'org.assertj:assertj-core:3.16.1'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'junit'
}
}

test {
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed May 27 14:56:20 KST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
1 change: 0 additions & 1 deletion src/test/java/webserver/ExecutorsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.util.StopWatch;

import java.util.concurrent.ExecutorService;
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/webserver/HttpRequestTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package webserver;

import org.junit.jupiter.api.Test;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import static org.assertj.core.api.Assertions.assertThat;

public class HttpRequestTest {
@Test
void request_resttemplate() {
RestTemplate restTemplate = new RestTemplate();
String resourceUrl = "https://edu.nextstep.camp";
ResponseEntity<String> response = restTemplate.getForEntity(resourceUrl + "/c/4YUvqn9V", String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
}
}

0 comments on commit c7c9f4e

Please sign in to comment.