diff options
author | 2018-06-18 20:07:14 +0300 | |
---|---|---|
committer | 2018-06-18 20:10:42 +0300 | |
commit | ba255a01b24485fe9793d34841b13a5479f6444a (patch) | |
tree | 98e0f228fb5f6b43a2e761e7a7ef4c6e9c103cc0 /workflow-designer-be/src | |
parent | 8f07b3287efedba992f037d499c7f55f71f823eb (diff) |
fix mapper unit tests
Change-Id: Ibbc47fe2d59c1fa95ee2a0212ebe6c293f5bdfd2
Issue-ID: SDC-1396
Signed-off-by: avigaffa <avi.gaffa@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src')
-rw-r--r-- | workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java (renamed from workflow-designer-be/src/test/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java) | 2 | ||||
-rw-r--r-- | workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/UniqueValueServiceTest.java (renamed from workflow-designer-be/src/test/org/onap/sdc/workflow/services/UniqueValueServiceTest.java) | 19 |
2 files changed, 4 insertions, 17 deletions
diff --git a/workflow-designer-be/src/test/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java index 3d5784bc..5371fd70 100644 --- a/workflow-designer-be/src/test/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/api/mapping/WorkflowMapperTest.java @@ -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 diff --git a/workflow-designer-be/src/test/org/onap/sdc/workflow/services/UniqueValueServiceTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/UniqueValueServiceTest.java index 57d06fcb..50a19655 100644 --- a/workflow-designer-be/src/test/org/onap/sdc/workflow/services/UniqueValueServiceTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/UniqueValueServiceTest.java @@ -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 - - } |