From 00c6ec7d386bd27c7752cf86e4692669e8b850ab Mon Sep 17 00:00:00 2001 From: pwielebs Date: Mon, 5 Feb 2018 14:57:43 +0100 Subject: Correction of unit tests in test class Change-Id: I4642fd858ea59024df61fe2f118852a8ccbce408 Issue-ID: SDC-1001 Signed-off-by: pwielebs --- .../sdc/asdctool/enums/SchemaZipFileEnumTest.java | 123 ++++++--------------- 1 file changed, 35 insertions(+), 88 deletions(-) (limited to 'asdctool/src') diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java index a84c74d2f5..307d7a0c16 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java @@ -1,121 +1,68 @@ package org.openecomp.sdc.asdctool.enums; +import org.junit.After; +import org.junit.Before; import org.junit.Test; +import static org.junit.Assert.*; -public class SchemaZipFileEnumTest { - private SchemaZipFileEnum createTestSubject() { - return SchemaZipFileEnum.DATA; - } +public class SchemaZipFileEnumTest { - - @Test - public void testGetFileName() throws Exception { - SchemaZipFileEnum testSubject; - String result; + private SchemaZipFileEnum testSubject; + private String result; - // default test + @Before + public void setUp() { testSubject = createTestSubject(); - result = testSubject.getFileName(); } - - @Test - public void testSetFileName() throws Exception { - SchemaZipFileEnum testSubject; - String fileName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setFileName(fileName); + @After + public void tearDown() { + testSubject = null; + result = null; } - @Test - public void testGetSourceFolderName() throws Exception { - SchemaZipFileEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSourceFolderName(); + public void setGetFileName_shouldSetCustomFileName() { + String fileName = "customFileName"; + testSubject.setFileName(fileName); + assertEquals(fileName, testSubject.getFileName()); } - @Test - public void testSetSourceFolderName() throws Exception { - SchemaZipFileEnum testSubject; - String sourceFolderName = ""; - - // default test - testSubject = createTestSubject(); + public void setGetSourceFolderName_shouldSetCustomSourceFolderName() { + String sourceFolderName = "customSourceFolderName"; testSubject.setSourceFolderName(sourceFolderName); + assertEquals(sourceFolderName, testSubject.getSourceFolderName()); } - - @Test - public void testGetSourceFileName() throws Exception { - SchemaZipFileEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getSourceFileName(); - } - - @Test - public void testSetSourceFileName() throws Exception { - SchemaZipFileEnum testSubject; - String sourceFileName = ""; - - // default test - testSubject = createTestSubject(); + public void setGetSourceFileName_shouldSetCustomSourceFileName() { + String sourceFileName = "customSourceFileName"; testSubject.setSourceFileName(sourceFileName); + assertEquals(sourceFileName, testSubject.getSourceFileName()); } - - @Test - public void testGetCollectionTitle() throws Exception { - SchemaZipFileEnum testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getCollectionTitle(); - } - - @Test - public void testSetCollectionTitle() throws Exception { - SchemaZipFileEnum testSubject; - String collectionTitle = ""; - - // default test - testSubject = createTestSubject(); + public void setGetCollectionTitle_shouldSetCustomCollectionTitle() { + String collectionTitle = "customCollectionTitle"; testSubject.setCollectionTitle(collectionTitle); + assertEquals(collectionTitle, testSubject.getCollectionTitle()); } - @Test - public void testGetImportFileList() throws Exception { - SchemaZipFileEnum testSubject; - String[] result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getImportFileList(); + public void setGetImportFileList_shouldSetGetFile1File2() { + String[] importFileList = new String[] { "File1", "File2" }; + String[] receivedImportFileList; + testSubject.setImportFileList(importFileList); + receivedImportFileList = testSubject.getImportFileList(); + assertNotNull(receivedImportFileList); + assertEquals("File1", receivedImportFileList[0]); + assertEquals("File2", receivedImportFileList[1]); } - - @Test - public void testSetImportFileList() throws Exception { - SchemaZipFileEnum testSubject; - String[] importFileList = new String[] { "" }; - - // default test - testSubject = createTestSubject(); - testSubject.setImportFileList(importFileList); + private SchemaZipFileEnum createTestSubject() { + return SchemaZipFileEnum.DATA; } } \ No newline at end of file -- cgit 1.2.3-korg