diff options
Diffstat (limited to 'common-app-api/src/test')
-rw-r--r-- | common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java | 26 | ||||
-rw-r--r-- | common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java | 2 | ||||
-rw-r--r-- | common-app-api/src/test/resources/config/fe/workspace-configuration.yaml (renamed from common-app-api/src/test/resources/config/common/workspace-configuration.yaml) | 0 |
3 files changed, 12 insertions, 16 deletions
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java b/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java index 49fc553302..35af78bd4e 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/common/util/YamlToObjectConverterTest.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Paths; +import org.openecomp.sdc.exception.YamlConversionException; import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertFalse; @@ -81,14 +82,14 @@ public class YamlToObjectConverterTest { } @Test - public void validateConvertWithFullFilePathReturnsValidObjectCreatedFromYaml() { + public void validateConvertWithFullFilePathReturnsValidObjectCreatedFromYaml() throws YamlConversionException { Configuration result = yamlToObjectConverter.convert(filePath+fileName, Configuration.class); assertThatCreatedObjectIsValid(result); } @Test - public void validateConvertWithFullFilePathReturnsNullIfFileDoesNotExist() { + public void validateConvertWithFullFilePathReturnsNullIfFileDoesNotExist() throws YamlConversionException { final String wrongFileName = "wrong-configuration.yaml"; Configuration result = yamlToObjectConverter.convert(wrongFileName, Configuration.class); @@ -96,28 +97,23 @@ public class YamlToObjectConverterTest { assertNull(result); } - @Test - public void validateConvertWithFullFilePathReturnsNullIfClassDoesNotMathYaml() { - - HttpClient result = yamlToObjectConverter.convert(filePath+fileName, HttpClient.class); - - assertNull(result); + @Test(expected = YamlConversionException.class) + public void validateConvertWithFullFilePathThrowsExceptionIfClassDoesNotMathYaml() throws YamlConversionException { + yamlToObjectConverter.convert(filePath + fileName, HttpClient.class); } @Test - public void validateConvertWithFilePathAndFileNameReturnsValidObjectCreatedFromYaml() { + public void validateConvertWithFilePathAndFileNameReturnsValidObjectCreatedFromYaml() + throws YamlConversionException { Configuration result = yamlToObjectConverter.convert(filePath, Configuration.class, fileName); assertThatCreatedObjectIsValid(result); } - @Test - public void validateConvertWithFilePathAndFileNameReturnsNullIfClassIsNull() { - - HttpClient result = yamlToObjectConverter.convert(filePath, null, fileName); - - assertNull(result); + @Test(expected = IllegalArgumentException.class) + public void validateConvertWithFilePathAndFileNameThrowsExceptionIfClassIsNull() throws YamlConversionException { + yamlToObjectConverter.convert(filePath, null, fileName); } @Test diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java index dd1fe8b2be..08e9b34195 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java @@ -41,7 +41,7 @@ public class WorkspaceConfigurationTest { @Before public void setUp() { - String appConfigDir = "src/test/resources/config/common"; + String appConfigDir = "src/test/resources/config/fe"; ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); configurationManager = new ConfigurationManager(configurationSource); diff --git a/common-app-api/src/test/resources/config/common/workspace-configuration.yaml b/common-app-api/src/test/resources/config/fe/workspace-configuration.yaml index fd382592b7..fd382592b7 100644 --- a/common-app-api/src/test/resources/config/common/workspace-configuration.yaml +++ b/common-app-api/src/test/resources/config/fe/workspace-configuration.yaml |