aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis
diff options
context:
space:
mode:
authorkaixiliu <liukaixi@chinamobile.com>2023-03-31 09:17:43 +0800
committerkaixiliu <liukaixi@chinamobile.com>2023-03-31 09:18:00 +0800
commitcd69d6ff83ee0d06683031f04ed71c692b6bffaa (patch)
tree3c4fe80f7b7dff8fa4b984e05dd873d71ad8d758 /intentanalysis
parent09a58f735485a43b32521806d3a8c038503cae83 (diff)
update ut code
Issue-ID: USECASEUI-785 Signed-off-by: kaixiliu <liukaixi@chinamobile.com> Change-Id: I9c1a1058047116d513fef129bfb03363b24217db
Diffstat (limited to 'intentanalysis')
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java9
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java32
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);