aboutsummaryrefslogtreecommitdiffstats
path: root/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java')
-rw-r--r--cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java47
1 files changed, 22 insertions, 25 deletions
diff --git a/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java
index 87b51e9357..6010726669 100644
--- a/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java
+++ b/cloudify-client/src/test/java/org/onap/so/cloudify/connector/http/HttpClientRedirectStrategyTest.java
@@ -1,20 +1,15 @@
/*
- * ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 Nokia.
- * =============================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * ============LICENSE_START======================================================= ONAP : SO
+ * ================================================================================ Copyright (C) 2018 Nokia.
+ * ============================================================================= Licensed under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy
+ * of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
* ============LICENSE_END=========================================================
*/
package org.onap.so.cloudify.connector.http;
@@ -23,7 +18,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
-
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.http.HttpRequest;
@@ -73,7 +67,7 @@ public class HttpClientRedirectStrategyTest {
}
private void assertHttpUriRequestFor(String methodName, Class<? extends HttpUriRequest> expectedHttpMethodClass)
- throws URISyntaxException, ProtocolException {
+ throws URISyntaxException, ProtocolException {
// GIVEN
HttpRequest request = mock(HttpRequest.class, RETURNS_DEEP_STUBS);
given(request.getRequestLine().getMethod()).willReturn(methodName);
@@ -81,8 +75,8 @@ public class HttpClientRedirectStrategyTest {
HttpContext context = null;
URI expectedUri = new URI("http://localhost/host");
// WHEN
- HttpUriRequest httpUriRequest = new TestableHttpClientRedirectStrategy(expectedUri)
- .getRedirect(request, response, context);
+ HttpUriRequest httpUriRequest =
+ new TestableHttpClientRedirectStrategy(expectedUri).getRedirect(request, response, context);
// THEN
assertThat(httpUriRequest).isInstanceOf(expectedHttpMethodClass);
assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri);
@@ -98,20 +92,22 @@ public class HttpClientRedirectStrategyTest {
URI expectedUri = new URI("http://localhost/host");
HttpContext context = null;
// WHEN
- HttpUriRequest httpUriRequest = new TestableHttpClientRedirectStrategy(expectedUri)
- .getRedirect(request, response, context);
+ HttpUriRequest httpUriRequest =
+ new TestableHttpClientRedirectStrategy(expectedUri).getRedirect(request, response, context);
// THEN
assertThat(httpUriRequest).isInstanceOf(HttpGet.class);
assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri);
}
@Test
- public void getRedirect_shouldCopyHttpRequestAndSetNewUri_forMovedTemporarilyStatus() throws URISyntaxException, ProtocolException {
+ public void getRedirect_shouldCopyHttpRequestAndSetNewUri_forMovedTemporarilyStatus()
+ throws URISyntaxException, ProtocolException {
assertHttpRequestIsCopied(HttpStatus.SC_MOVED_TEMPORARILY);
}
@Test
- public void getRedirect_shouldCopyHttpRequestAndSetNewUri_forTemporaryRedirectStatus() throws URISyntaxException, ProtocolException {
+ public void getRedirect_shouldCopyHttpRequestAndSetNewUri_forTemporaryRedirectStatus()
+ throws URISyntaxException, ProtocolException {
assertHttpRequestIsCopied(HttpStatus.SC_TEMPORARY_REDIRECT);
}
@@ -125,8 +121,8 @@ public class HttpClientRedirectStrategyTest {
URI expectedUri = new URI("http://localhost/host");
HttpContext context = null;
// WHEN
- HttpUriRequest httpUriRequest = new TestableHttpClientRedirectStrategy(expectedUri)
- .getRedirect(request, response, context);
+ HttpUriRequest httpUriRequest =
+ new TestableHttpClientRedirectStrategy(expectedUri).getRedirect(request, response, context);
// THEN
assertThat(httpUriRequest).isInstanceOf(HttpGet.class);
assertThat(httpUriRequest.getURI()).isEqualTo(expectedUri);
@@ -139,9 +135,10 @@ public class HttpClientRedirectStrategyTest {
public TestableHttpClientRedirectStrategy(URI expectedUri) {
this.expectedUri = expectedUri;
}
+
@Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) {
return expectedUri;
}
}
-} \ No newline at end of file
+}