From 1a3e5293ff6511b957cc63ad477c50d39b3764b4 Mon Sep 17 00:00:00 2001 From: Neil McErlean Date: Mon, 15 Jun 2015 13:24:16 +0000 Subject: [PATCH] Additional checkin related to RM-2291. Change the unit test so that it validates only the levels configured by the user (in .json file) and excludes the built-in special case of Unclassified. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@106141 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../ClassificationServiceBootstrapUnitTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java index 937d9eddc0..f1e7dfa3c2 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/ClassificationServiceBootstrapUnitTest.java @@ -19,6 +19,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification; import static java.util.Arrays.asList; +import static org.apache.commons.collections.ListUtils.union; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; @@ -57,10 +58,13 @@ import org.mockito.MockitoAnnotations; */ public class ClassificationServiceBootstrapUnitTest { - private static final List DEFAULT_CLASSIFICATION_LEVELS = asLevelList("TS", "rm.classification.topSecret", - "S", "rm.classification.secret", - "C", "rm.classification.confidential", - "U", "rm.classification.unclassified"); + private static final List DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS = + asLevelList("TS", "rm.classification.topSecret", + "S", "rm.classification.secret", + "C", "rm.classification.confidential"); + private static final List DEFAULT_CLASSIFICATION_LEVELS = + union(DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS, + asLevelList("U", "rm.classification.unclassified")); private static final List ALT_CLASSIFICATION_LEVELS = asLevelList("B", "Board", "EM", "ExecutiveManagement", "E", "Employee", @@ -115,12 +119,12 @@ public class ClassificationServiceBootstrapUnitTest @Test public void defaultLevelsConfigurationVanillaSystem() { - when(mockClassificationServiceDAO.getConfiguredLevels()).thenReturn(DEFAULT_CLASSIFICATION_LEVELS); + when(mockClassificationServiceDAO.getConfiguredLevels()).thenReturn(DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS); when(mockAttributeService.getAttribute(anyString(), anyString(), anyString())).thenReturn(null); classificationServiceBootstrap.initConfiguredClassificationLevels(); - verify(mockAttributeService).setAttribute(eq((Serializable) DEFAULT_CLASSIFICATION_LEVELS), + verify(mockAttributeService).setAttribute(eq((Serializable) DEFAULT_CONFIGURED_CLASSIFICATION_LEVELS), anyString(), anyString(), anyString()); }