summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java12
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProviderTest.java16
2 files changed, 13 insertions, 15 deletions
diff --git a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
index 79ea56a..2dbb6c1 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ApiVersionsReaderTest.java
@@ -36,13 +36,12 @@ import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.ValueSource;
import org.onap.sdc.helmvalidator.helm.versions.exception.ApiVersionNotFoundException;
import org.onap.sdc.helmvalidator.helm.versions.exception.ReadFileException;
class ApiVersionsReaderTest {
+ private static final String API_VERSION_V2= "v2";
private static final String TEST_RESOURCES_TMP = "src/test/resources/tmp";
private static final Path TEST_CHART_PATH = Path.of(TEST_RESOURCES_TMP).resolve(Path.of("Chart.yaml"));
@@ -55,14 +54,13 @@ class ApiVersionsReaderTest {
apiVersionsReader = new ApiVersionsReader();
}
- @ParameterizedTest
- @ValueSource(strings = {"v1", "v2"})
- void shouldCorrectlyReadApiVersionFromTar(String apiVersion) throws IOException {
- prepareTestTar(apiVersion);
+ @Test
+ void shouldCorrectlyReadApiVersionFromTar() throws IOException {
+ prepareTestTar(API_VERSION_V2);
String helmVersion = apiVersionsReader.readVersion(TEST_TAR_PATH.toString());
- assertThat(helmVersion).isEqualTo(apiVersion);
+ assertThat(helmVersion).isEqualTo(API_VERSION_V2);
}
@Test
diff --git a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProviderTest.java b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProviderTest.java
index 64daf2d..7819aa5 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProviderTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/helm/versions/ChartBasedVersionProviderTest.java
@@ -27,8 +27,6 @@ import static org.mockito.Mockito.when;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.CsvSource;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@@ -37,6 +35,9 @@ import org.onap.sdc.helmvalidator.helm.versions.exception.NotSupportedApiVersion
@ExtendWith(MockitoExtension.class)
class ChartBasedVersionProviderTest {
+ private static final String EXPECTED_HELM_VERSION = "3.4.3";
+ private static final String API_VERSION = "v2";
+
private final String testChartPath = "test/path";
@Mock
private SupportedVersionsProvider versionsProvider;
@@ -49,15 +50,14 @@ class ChartBasedVersionProviderTest {
chartBasedVersionProvider = new ChartBasedVersionProvider(versionsProvider, apiVersionsReader);
}
- @ParameterizedTest
- @CsvSource({"v1,2.18", "v2,3.11"})
- void shouldGetLatestHelmVersionBasedOnApiVersion(String apiVersion, String expectedHelmVersion) {
- when(apiVersionsReader.readVersion(testChartPath)).thenReturn(apiVersion);
- when(versionsProvider.getLatestVersion(Mockito.anyString())).thenReturn(expectedHelmVersion);
+ @Test
+ void shouldGetLatestHelmVersionBasedOnApiVersion() {
+ when(apiVersionsReader.readVersion(testChartPath)).thenReturn(API_VERSION);
+ when(versionsProvider.getLatestVersion(Mockito.anyString())).thenReturn(EXPECTED_HELM_VERSION);
String helmVersion = chartBasedVersionProvider.getVersion(testChartPath);
- assertThat(helmVersion).isEqualTo(expectedHelmVersion);
+ assertThat(helmVersion).isEqualTo(EXPECTED_HELM_VERSION);
}
@Test