From 5521870d6498930287da8fc92dcc8bf88279bae6 Mon Sep 17 00:00:00 2001 From: Haroon Khan Date: Mon, 10 Jan 2022 08:57:45 +0000 Subject: [PATCH] [JAVA-9347] Split spring-rest-http module --- .../spring-rest-http-2/README.md | 4 ++- .../uribuilder/SpringUriBuilderUnitTest.java} | 26 ++++++++++++------- spring-web-modules/spring-rest-http/README.md | 4 +-- 3 files changed, 22 insertions(+), 12 deletions(-) rename spring-web-modules/{spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java => spring-rest-http-2/src/test/java/com/baeldung/uribuilder/SpringUriBuilderUnitTest.java} (74%) diff --git a/spring-web-modules/spring-rest-http-2/README.md b/spring-web-modules/spring-rest-http-2/README.md index 74e55c7c40..bb9175db8c 100644 --- a/spring-web-modules/spring-rest-http-2/README.md +++ b/spring-web-modules/spring-rest-http-2/README.md @@ -1,6 +1,6 @@ ## Spring REST HTTP 2 -This module contains articles about HTTP in REST APIs with Spring +This module contains articles about HTTP in REST APIs with Spring. ### The Course The "REST With Spring 2" Classes: http://bit.ly/restwithspring @@ -10,3 +10,5 @@ The "REST With Spring 2" Classes: http://bit.ly/restwithspring - [How to Turn Off Swagger-ui in Production](https://www.baeldung.com/swagger-ui-turn-off-in-production) - [Setting a Request Timeout for a Spring REST API](https://www.baeldung.com/spring-rest-timeout) - [Long Polling in Spring MVC](https://www.baeldung.com/spring-mvc-long-polling) +- [Guide to UriComponentsBuilder in Spring](https://www.baeldung.com/spring-uricomponentsbuilder) +- More articles: [[<-- prev]](../spring-rest-http) diff --git a/spring-web-modules/spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java b/spring-web-modules/spring-rest-http-2/src/test/java/com/baeldung/uribuilder/SpringUriBuilderUnitTest.java similarity index 74% rename from spring-web-modules/spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java rename to spring-web-modules/spring-rest-http-2/src/test/java/com/baeldung/uribuilder/SpringUriBuilderUnitTest.java index 0af5cb1e1a..b4f261cd6e 100644 --- a/spring-web-modules/spring-rest-http/src/test/java/com/baeldung/uribuilder/SpringUriBuilderIntegrationTest.java +++ b/spring-web-modules/spring-rest-http-2/src/test/java/com/baeldung/uribuilder/SpringUriBuilderUnitTest.java @@ -1,39 +1,47 @@ package com.baeldung.uribuilder; -import static org.junit.Assert.assertEquals; - -import java.util.Collections; - import org.junit.Test; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; -public class SpringUriBuilderIntegrationTest { +import java.util.Collections; + +import static org.junit.Assert.assertEquals; + +public class SpringUriBuilderUnitTest { @Test public void constructUri() { - UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/junit-5").build(); + UriComponents uriComponents = UriComponentsBuilder.newInstance() + .scheme("http").host("www.baeldung.com").path("/junit-5") + .build(); assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString()); } @Test public void constructUriEncoded() { - UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/junit 5").build().encode(); + UriComponents uriComponents = UriComponentsBuilder.newInstance() + .scheme("http").host("www.baeldung.com").path("/junit 5") + .build().encode(); assertEquals("http://www.baeldung.com/junit%205", uriComponents.toUriString()); } @Test public void constructUriFromTemplate() { - UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.baeldung.com").path("/{article-name}").buildAndExpand("junit-5"); + UriComponents uriComponents = UriComponentsBuilder.newInstance() + .scheme("http").host("www.baeldung.com").path("/{article-name}") + .buildAndExpand("junit-5"); assertEquals("http://www.baeldung.com/junit-5", uriComponents.toUriString()); } @Test public void constructUriWithQueryParameter() { - UriComponents uriComponents = UriComponentsBuilder.newInstance().scheme("http").host("www.google.com").path("/").query("q={keyword}").buildAndExpand("baeldung"); + UriComponents uriComponents = UriComponentsBuilder.newInstance() + .scheme("http").host("www.google.com").path("/").query("q={keyword}") + .buildAndExpand("baeldung"); assertEquals("http://www.google.com/?q=baeldung", uriComponents.toUriString()); } diff --git a/spring-web-modules/spring-rest-http/README.md b/spring-web-modules/spring-rest-http/README.md index 2271858f0a..43355d27cd 100644 --- a/spring-web-modules/spring-rest-http/README.md +++ b/spring-web-modules/spring-rest-http/README.md @@ -1,13 +1,12 @@ ## Spring REST HTTP -This module contains articles about HTTP in REST APIs with Spring +This module contains articles about HTTP in REST APIs with Spring. ### The Course The "REST With Spring" Classes: http://bit.ly/restwithspring ### Relevant Articles: -- [Guide to UriComponentsBuilder in Spring](https://www.baeldung.com/spring-uricomponentsbuilder) - [How to Set a Header on a Response with Spring 5](https://www.baeldung.com/spring-response-header) - The tests contained for this article rely on the sample application within the [spring-resttemplate](/spring-resttemplate) module - [Returning Custom Status Codes from Spring Controllers](https://www.baeldung.com/spring-mvc-controller-custom-http-status-code) - [Spring RequestMapping](https://www.baeldung.com/spring-requestmapping) @@ -15,3 +14,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Using JSON Patch in Spring REST APIs](https://www.baeldung.com/spring-rest-json-patch) - [OpenAPI JSON Objects as Query Parameters](https://www.baeldung.com/openapi-json-query-parameters) - [Dates in OpenAPI Files](https://www.baeldung.com/openapi-dates) +- More articles: [[next -->]](../spring-rest-http-2)