diff options
Diffstat (limited to 'intentanalysis')
2 files changed, 11 insertions, 30 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java index 2f91691..055ac2e 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java @@ -121,14 +121,7 @@ public class CLLBusinessIntentManagementFunctionTest { cllBusinessIntentManagementFunction.investigation(intentGoalBean); Assert.assertTrue(true); } - @Test - public void testImplementIntentCreate() { // TODO: 2023/3/30 - LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>(); - map.put(intentGoalBean, cllDeliveryIntentManagementFunction); - Mockito.when(decisionModule.intentObjectDefine(any(),any())).thenReturn(intent); - cllBusinessIntentManagementFunction.implementIntent(intent, map); - Assert.assertTrue(true); - } + @Test public void testImplementIntentUpdate() { LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>(); diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java index fb30aaa..7c494f7 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java @@ -68,11 +68,8 @@ public class IntentControllerTest { public void testCreateIntent() { Intent intent = new Intent(); intent.setIntentName("cllBussinessIntent"); - IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); intentController.createIntent(intent); - verify(intentProcessService, times(1)).intentProcess(any()); - verify(intentService, times(1)).createIntent(any()); + verify(formatIntentInputManagementFunction, times(1)).receiveIntentAsOwner(any()); } @@ -81,27 +78,22 @@ public class IntentControllerTest { Intent intent = new Intent(); intent.setIntentName("cllBussinessIntent"); IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - //Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); - when(intentProcessService.intentProcess(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL)); intentController.createIntent(intent); Assert.assertTrue(true); } - @Test + @Test public void testUpdateIntentById(){ - Intent intent = new Intent(); - intent.setIntentName("cllBussinessIntent"); - IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - - Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); - intentController.updateIntentById(any(),any()); - verify(intentProcessService, times(1)).intentProcess(any()); - } + Intent intent = new Intent(); + intent.setIntentId("test"); + intent.setIntentName("cllBussinessIntent"); + IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); + intentController.updateIntentById(intent.getIntentId(),intent); + verify(formatIntentInputManagementFunction, times(1)).receiveIntentAsOwner(any()); + } @Test public void testUpdateIntentByIdCommonException() { Intent intent = new Intent(); intent.setIntentName("cllBussinessIntent"); - IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - //Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); when(intentProcessService.intentProcess(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL)); intentController.updateIntentById(any(),any()); Assert.assertTrue(true); @@ -113,11 +105,8 @@ public class IntentControllerTest { intent.setIntentName("cllBussinessIntent"); String id = "intentId"; IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - - Mockito.when(intentService.getIntent(any())).thenReturn(intent); - Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); intentController.removeIntentById(id); - verify(intentProcessService, times(1)).intentProcess(any()); + verify(formatIntentInputManagementFunction, times(1)).receiveIntentAsOwner(any()); } @Test @@ -125,7 +114,6 @@ public class IntentControllerTest { Intent intent = new Intent(); intent.setIntentName("cllBussinessIntent"); IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE); - //Mockito.when(intentProcessService.intentProcess(any())).thenReturn(intentGoalBean); when(intentProcessService.intentProcess(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL)); intentController.removeIntentById("intentId"); Assert.assertTrue(true); |