Correction of unit tests in test class 89/30289/2
authorpwielebs <piotr.wielebski@nokia.com>
Mon, 5 Feb 2018 13:57:43 +0000 (14:57 +0100)
committerpwielebs <piotr.wielebski@nokia.com>
Mon, 5 Feb 2018 15:00:04 +0000 (16:00 +0100)
Change-Id: I4642fd858ea59024df61fe2f118852a8ccbce408
Issue-ID: SDC-1001
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
asdctool/src/test/java/org/openecomp/sdc/asdctool/enums/SchemaZipFileEnumTest.java

index a84c74d..307d7a0 100644 (file)
 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