aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/sdc/helmvalidator/helm/validation/FileManagerTest.java21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/test/java/org/onap/sdc/helmvalidator/helm/validation/FileManagerTest.java b/src/test/java/org/onap/sdc/helmvalidator/helm/validation/FileManagerTest.java
index 89eab80..8057303 100644
--- a/src/test/java/org/onap/sdc/helmvalidator/helm/validation/FileManagerTest.java
+++ b/src/test/java/org/onap/sdc/helmvalidator/helm/validation/FileManagerTest.java
@@ -47,7 +47,6 @@ class FileManagerTest {
private static final String TEST_RESOURCES_TMP = "src/test/resources/tmp";
private static final File TEST_RESOURCES_DIR = new File(TEST_RESOURCES_TMP);
private static final ByteArrayInputStream TEST_INPUT_STREAM = new ByteArrayInputStream("test".getBytes());
- private static final String SAMPLE_FILE_NAME = "sample_file";
private FileManager fileManager;
@@ -71,7 +70,7 @@ class FileManagerTest {
@BeforeEach
void setUp() {
- fileManager = new FileManager(TEST_RESOURCES_TMP);
+ fileManager = new FileManager(TEST_RESOURCES_DIR.getAbsolutePath());
}
@Test
@@ -95,25 +94,7 @@ class FileManagerTest {
assertThat(Files.exists(Paths.get(filePath))).isFalse();
}
- @Test
- void shouldThrowExceptionWhenFileContainsSlash() {
- when(multipartFile.getOriginalFilename()).thenReturn(SAMPLE_FILE_NAME + "/");
- Exception exception = assertThrows(SaveFileException.class,
- () -> fileManager.saveFile(multipartFile));
- assertThat(exception).hasMessageContaining("Not allowed file name");
- }
-
- @Test
- void shouldThrowExceptionWhenFileNameIsNull() {
- when(multipartFile.getOriginalFilename()).thenReturn(null);
-
- Exception exception = assertThrows(SaveFileException.class,
- () -> fileManager.saveFile(multipartFile));
- assertThat(exception).hasMessageContaining("Not allowed file name");
- }
-
private void mockMultipartFile() throws IOException {
- when(multipartFile.getOriginalFilename()).thenReturn(SAMPLE_FILE_NAME);
when(multipartFile.getInputStream()).thenReturn(TEST_INPUT_STREAM);
}
}