diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml index 05d77d40ef..63ccdb75e8 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v35-context.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - + holdList = new ArrayList<>(); - when(filePlanService.getFilePlans()).thenReturn(fileplans); - when(holdService.getHolds(filePlanRef)).thenReturn(holdList); - - verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); - verify(holdService, times(0)).addToHold(holdRef, heldItemRef); - - //child assocs holdList.add(holdRef); when(childAssociationRef.getChildRef()).thenReturn(heldItemRef); - when(nodeService.getChildAssocs(holdRef)).thenReturn(new ArrayList<>()); + when(mockNodeService.getChildAssocs(holdRef)).thenReturn(new ArrayList<>()); patch.applyInternal(); - verify(holdService, times(0)).removeFromHold(holdRef, heldItemRef); - verify(holdService, times(0)).addToHold(holdRef, heldItemRef); + + verify(mockHoldService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(mockHoldService, times(0)).addToHold(holdRef, heldItemRef); } + @Test + public void patchRunWithSuccessWhenNoHolds() + { + //no holds + List holdList = new ArrayList<>(); + when(mockFilePlanService.getFilePlans()).thenReturn(fileplans); + when(mockHoldService.getHolds(filePlanRef)).thenReturn(holdList); + patch.applyInternal(); + + verify(mockHoldService, times(0)).removeFromHold(holdRef, heldItemRef); + verify(mockHoldService, times(0)).addToHold(holdRef, heldItemRef); + } + + @Test + public void patchRunWithSuccessWhenNoFilePlan() + { + // given + doReturn(Collections.EMPTY_SET).when(mockFilePlanService).getFilePlans(); + + // when + patch.applyInternal(); + + // then + verifyZeroInteractions(mockHoldService); + verify(mockNodeService, times(0)).addAspect(any(NodeRef.class), any(QName.class), anyMap()); + } }