Fix failing test on Sonar build.

Avoid calling the I18N utility by checking the display label key directly.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@105312 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-06-02 09:21:30 +00:00
parent 7916227e88
commit 81dbb54471
2 changed files with 14 additions and 3 deletions

View File

@@ -84,4 +84,15 @@ public class ClearanceLevel
} }
@Override public int hashCode() { return highestClassificationLevel.hashCode(); } @Override public int hashCode() { return highestClassificationLevel.hashCode(); }
/**
* Get the display label key. This method is used for unit testing, where we want to avoid problems introduced by
* the static call to the I18N utility.
*
* @return The key for the display label of this security clearance.
*/
protected String getDisplayLabelKey()
{
return displayLabelKey;
}
} }

View File

@@ -235,8 +235,8 @@ public class ClassificationServiceBootstrapUnitTest
List<ClearanceLevel> clearanceLevels = clearanceLevelCaptor.getValue(); List<ClearanceLevel> clearanceLevels = clearanceLevelCaptor.getValue();
assertEquals("There should be one clearance level for each classification level.", classificationLevels.size(), clearanceLevels.size()); assertEquals("There should be one clearance level for each classification level.", classificationLevels.size(), clearanceLevels.size());
assertEquals("TopSecret", clearanceLevels.get(0).getDisplayLabel()); assertEquals("TopSecret", clearanceLevels.get(0).getDisplayLabelKey());
assertEquals("Secret", clearanceLevels.get(1).getDisplayLabel()); assertEquals("Secret", clearanceLevels.get(1).getDisplayLabelKey());
assertEquals("rm.classification.noClearance", clearanceLevels.get(2).getDisplayLabel()); assertEquals("rm.classification.noClearance", clearanceLevels.get(2).getDisplayLabelKey());
} }
} }