aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-08-29 16:13:33 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-08-29 16:43:31 +0000
commit1b46a6e1d6fcf9788c9f18552f6f6b8fed60126c (patch)
tree4e63a047fb758bc15aa4594202a4ade33aeb9f47 /sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java
parentcc595a0bfd90645b451ddee658fc496624072cea (diff)
Migrate to Junit5
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I00d5d08f0ad3ceeec94286f6500c4592585e7e34 Issue-ID: SDC-4148
Diffstat (limited to 'sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java')
-rw-r--r--sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java39
1 files changed, 17 insertions, 22 deletions
diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java b/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java
index eb5c1eb..8a912d9 100644
--- a/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java
+++ b/sdc-distribution-client/src/test/java/org/onap/sdc/http/HttpAsdcClientResponseTest.java
@@ -19,44 +19,39 @@
*/
package org.onap.sdc.http;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpStatus;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collection;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpStatus;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.mockito.junit.jupiter.MockitoExtension;
+@ExtendWith(MockitoExtension.class)
+class HttpAsdcClientResponseTest {
-@RunWith(value = Parameterized.class)
-public class HttpAsdcClientResponseTest {
- @Parameterized.Parameter
- public int httpStatusCode;
-
- @Parameterized.Parameter(value = 1)
- public String httpMessage;
-
- @Parameterized.Parameters(name = "{index}: test({0},{1}) = {0} {1}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
- {HttpStatus.SC_INTERNAL_SERVER_ERROR, "failed to send request"},
- {HttpStatus.SC_BAD_GATEWAY, "failed to connect"},
- {HttpStatus.SC_BAD_GATEWAY, "failed to send request "}
+ {HttpStatus.SC_INTERNAL_SERVER_ERROR, "failed to send request"},
+ {HttpStatus.SC_BAD_GATEWAY, "failed to connect"},
+ {HttpStatus.SC_BAD_GATEWAY, "failed to send request "}
});
}
- @Test
- public void shouldCreateHttpResponse() throws IOException {
+ @ParameterizedTest
+ @MethodSource("data")
+ void shouldCreateHttpResponse(int httpStatusCode, String httpMessage) throws IOException {
// when
final HttpAsdcResponse response = HttpAsdcClient.createHttpResponse(httpStatusCode, httpMessage);
// then
- Assert.assertEquals(httpStatusCode, response.getStatus());
- Assert.assertEquals(httpMessage, getResponseMessage(response));
+ assertEquals(httpStatusCode, response.getStatus());
+ assertEquals(httpMessage, getResponseMessage(response));
}
private String getResponseMessage(HttpAsdcResponse response) throws IOException {