fix mapper unit tests 21/55021/1
authoravigaffa <avi.gaffa@amdocs.com>
Mon, 18 Jun 2018 17:07:14 +0000 (20:07 +0300)
committeravigaffa <avi.gaffa@amdocs.com>
Mon, 18 Jun 2018 17:10:42 +0000 (20:10 +0300)
Change-Id: Ibbc47fe2d59c1fa95ee2a0212ebe6c293f5bdfd2
Issue-ID: SDC-1396
Signed-off-by: avigaffa <avi.gaffa@amdocs.com>
workflow-designer-be/pom.xml
workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java [moved from workflow-designer-be/src/test/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java with 97% similarity]
workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/UniqueValueServiceTest.java [moved from workflow-designer-be/src/test/org/onap/sdc/workflow/services/UniqueValueServiceTest.java with 87% similarity]

index 65f239a..226bfef 100644 (file)
             <groupId>org.openecomp.sdc</groupId>
             <artifactId>openecomp-sdc-versioning-api</artifactId>
             <version>${onap.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.testng</groupId>
+                    <artifactId>testng</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.openecomp.sdc</groupId>
             <artifactId>mapstruct-jdk8</artifactId>
             <version>${org.mapstruct.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter-api</artifactId>
-            <version>RELEASE</version>
-            <scope>test</scope>
-        </dependency>
-
     </dependencies>
 
     <build>
@@ -22,7 +22,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 public class WorkflowMapperTest {
 
     @Configuration
-    @ComponentScan(basePackageClasses = WorkflowMapperTest.class)
+    @ComponentScan(basePackageClasses = {WorkflowMapper.class})
     public static class WorkflowMapperSpringTestConfig { }
 
     @Autowired
@@ -4,7 +4,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.times;
@@ -23,8 +22,8 @@ import org.onap.sdc.workflow.services.errors.UniqueValueViolationException;
 
 public class UniqueValueServiceTest {
 
-    public static final String TYPE = "ss";
-    public static final String DUMMY_COMBINATION = "dummy";
+    private static final String TYPE = "ss";
+    private static final String DUMMY_COMBINATION = "dummy";
 
     @Mock
     private UniqueValueRepository uniqueValueRepositoryMock;
@@ -34,11 +33,10 @@ public class UniqueValueServiceTest {
     private UniqueValueService uniqueValueService;
 
     @Before
-    public void setUp() throws Exception {
+    public void setUp() {
         MockitoAnnotations.initMocks(this);
     }
 
-    // testing create unique value- START
     @Test
     public void shouldCallRepositoryInsertIfValueUnique(){
         doReturn(Optional.empty()).when(uniqueValueRepositoryMock).findById(any());
@@ -57,9 +55,7 @@ public class UniqueValueServiceTest {
         doReturn(Optional.of("xxx")).when(uniqueValueRepositoryMock).findById(any());
         uniqueValueService.createUniqueValue(TYPE, new String[]{DUMMY_COMBINATION});
     }
-    // testing create unique value- END
 
-    // testing delete unique value- START
     @Test
     public void shouldCallRepositoryDeleteIfValueValid(){
         uniqueValueService.deleteUniqueValue(TYPE, new String[]{DUMMY_COMBINATION});
@@ -72,9 +68,6 @@ public class UniqueValueServiceTest {
         verify(uniqueValueRepositoryMock, never()).delete(any(UniqueValueEntity.class));
     }
 
-    // testing delete unique value- END
-
-    // testing update unique value- START
     @Test
     public void shouldNotUpdateIfNewAndOldValueAreEqualsCaseIgnore(){
         String value = "value";
@@ -90,9 +83,7 @@ public class UniqueValueServiceTest {
         verify(uniqueValueService, times(1)).createUniqueValue(anyString(), any());
         verify(uniqueValueService, times(1)).deleteUniqueValue(anyString(), any());
     }
-    // testing update unique value- END
 
-    // testing validateUniqueValue- START
     @Test
     public void shouldReturnTrueIfValueExist() {
         doReturn(Optional.of("xxx")).when(uniqueValueRepositoryMock).findById(any());
@@ -104,8 +95,4 @@ public class UniqueValueServiceTest {
         doReturn(Optional.empty()).when(uniqueValueRepositoryMock).findById(any());
         assertFalse(uniqueValueService.isUniqueValueOccupied(TYPE, new String[]{DUMMY_COMBINATION}));
     }
-
-    // testing validate unique value- END
-
-
 }