mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Addressing code review comments. Part of RM-2481, RM-2482, RM-2483 and RM-2489.
Mostly removing unnecessary Hamcrest matchers to make the code a little less verbose. Good! git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@110165 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.model.clf;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import static org.mockito.Mockito.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.initMocks;
|
||||
@@ -70,11 +69,11 @@ public class ClassifiedRenditionsUnitTest implements ClassifiedContentModel
|
||||
|
||||
@Test public void newRenditionOfClassifiedNodeShouldItselfBeClassified()
|
||||
{
|
||||
when(mockRenditionService.getRenditions(eq(SOURCE_NODE)))
|
||||
when(mockRenditionService.getRenditions(SOURCE_NODE))
|
||||
.thenReturn(asList(rendition(SOURCE_NODE, RENDITION_1), rendition(SOURCE_NODE, RENDITION_2)));
|
||||
when(mockRenditionService.getSourceNode(eq(RENDITION_1))).thenReturn(rendition(SOURCE_NODE, RENDITION_1));
|
||||
when(mockRenditionService.getSourceNode(eq(RENDITION_2))).thenReturn(rendition(SOURCE_NODE, RENDITION_2));
|
||||
when(mockContentClassificationService.isClassified(eq(SOURCE_NODE))).thenReturn(true);
|
||||
when(mockRenditionService.getSourceNode(RENDITION_1)).thenReturn(rendition(SOURCE_NODE, RENDITION_1));
|
||||
when(mockRenditionService.getSourceNode(RENDITION_2)).thenReturn(rendition(SOURCE_NODE, RENDITION_2));
|
||||
when(mockContentClassificationService.isClassified(SOURCE_NODE)).thenReturn(true);
|
||||
|
||||
final ClassifiedRenditions behaviour = new ClassifiedRenditions();
|
||||
behaviour.setAuthenticationUtil(mockAuthenticationUtil);
|
||||
@@ -85,10 +84,10 @@ public class ClassifiedRenditionsUnitTest implements ClassifiedContentModel
|
||||
|
||||
behaviour.onAddAspect(RENDITION_2, RenditionModel.ASPECT_RENDITION);
|
||||
|
||||
verify(mockCoreServicesExtras).copyAspect(eq(SOURCE_NODE), eq(RENDITION_2), eq(ClassifiedContentModel.ASPECT_CLASSIFIED));
|
||||
verify(mockCoreServicesExtras).copyAspect(SOURCE_NODE, RENDITION_2, ClassifiedContentModel.ASPECT_CLASSIFIED);
|
||||
}
|
||||
|
||||
/** Creates a mock Rendition ChildAssociationRef. */
|
||||
/** Creates a test Rendition ChildAssociationRef. */
|
||||
private ChildAssociationRef rendition(NodeRef source, NodeRef rendition)
|
||||
{
|
||||
return new ChildAssociationRef(RenditionModel.ASSOC_RENDITION, source, RenditionModel.ASSOC_RENDITION, rendition);
|
||||
|
@@ -152,7 +152,7 @@ public class ClassifiedAspectUnitTest implements ClassifiedContentModel
|
||||
|
||||
for (NodeRef rendition : asList(RENDITION_1, RENDITION_2))
|
||||
{
|
||||
verify(mockCoreServicesExtras).copyAspect(eq(NODE_REF), eq(rendition), eq(ClassifiedContentModel.ASPECT_CLASSIFIED));
|
||||
verify(mockCoreServicesExtras).copyAspect(NODE_REF, rendition, ClassifiedContentModel.ASPECT_CLASSIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ public class ClassifiedAspectUnitTest implements ClassifiedContentModel
|
||||
{
|
||||
when(mockNodeService.hasAspect(n, ASPECT_CLASSIFIED)).thenReturn(true);
|
||||
}
|
||||
when(mockClassificationSchemeService.getClassificationLevelById(eq("Top Secret"))).thenReturn(TOP_SECRET);
|
||||
when(mockClassificationSchemeService.getClassificationLevelById(eq("Secret"))).thenReturn(SECRET);
|
||||
when(mockClassificationSchemeService.getClassificationLevelById("Top Secret")).thenReturn(TOP_SECRET);
|
||||
when(mockClassificationSchemeService.getClassificationLevelById("Secret")).thenReturn(SECRET);
|
||||
when(mockClassificationSchemeService.getReclassification(any(), any())).thenReturn(ClassificationSchemeService.Reclassification.DOWNGRADE);
|
||||
when(mockRenditionService.getRenditions(eq(NODE_REF)))
|
||||
.thenReturn(asList(rendition(NODE_REF, RENDITION_1), rendition(NODE_REF, RENDITION_2)));
|
||||
@@ -178,11 +178,11 @@ public class ClassifiedAspectUnitTest implements ClassifiedContentModel
|
||||
|
||||
for (NodeRef rendition : asList(RENDITION_1, RENDITION_2))
|
||||
{
|
||||
verify(mockCoreServicesExtras).copyAspect(eq(NODE_REF), eq(rendition), eq(ClassifiedContentModel.ASPECT_CLASSIFIED));
|
||||
verify(mockCoreServicesExtras).copyAspect(NODE_REF, rendition, ClassifiedContentModel.ASPECT_CLASSIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a mock Rendition ChildAssociationRef. */
|
||||
/** Creates a test Rendition ChildAssociationRef. */
|
||||
private ChildAssociationRef rendition(NodeRef source, NodeRef rendition)
|
||||
{
|
||||
return new ChildAssociationRef(RenditionModel.ASSOC_RENDITION, source, RenditionModel.ASSOC_RENDITION, rendition);
|
||||
|
Reference in New Issue
Block a user