From 8ca5dda4a4d6331728ab8c68e171644579316819 Mon Sep 17 00:00:00 2001 From: Oana Nechiforescu Date: Wed, 24 Jun 2015 07:58:15 +0000 Subject: [PATCH] RM-2324 AC Automation: Invalid values Added unit tests for ExemptionCategoryFieldsValidator. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@106913 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- ...mptionCategoryFieldsValidatorUnitTest.java | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/validation/ExemptionCategoryFieldsValidatorUnitTest.java diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/validation/ExemptionCategoryFieldsValidatorUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/validation/ExemptionCategoryFieldsValidatorUnitTest.java new file mode 100644 index 0000000000..3fb6d19e05 --- /dev/null +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/classification/validation/ExemptionCategoryFieldsValidatorUnitTest.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2005-2015 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.classification.validation; + +import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.IllegalConfiguration; +import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationException.MissingConfiguration; +import org.alfresco.module.org_alfresco_module_rm.classification.ExemptionCategory; +import org.junit.Test; + +/** + * Unit tests for the {@link ExemptionCategoryFieldsValidator}. + * + * @author onechiforescu + * + */ + +public class ExemptionCategoryFieldsValidatorUnitTest +{ + + ExemptionCategoryFieldsValidator exemptionCategoryFieldsValidator = new ExemptionCategoryFieldsValidator(); + + @Test(expected = MissingConfiguration.class) + public void testMissingExemptionCategoryID() + { + + ExemptionCategory exemptionCategory = new ExemptionCategory("", "label"); + exemptionCategoryFieldsValidator.validate(exemptionCategory); + + } + + @Test(expected = MissingConfiguration.class) + public void testMissingExemptionCategoryLabel() + { + + ExemptionCategory exemptionCategory = new ExemptionCategory("12@1", ""); + exemptionCategoryFieldsValidator.validate(exemptionCategory); + + } + + @Test(expected = IllegalConfiguration.class) + public void testExemptionIDStartingWithNonAlphanumericCharacter() + { + + ExemptionCategory exemptionCategory = new ExemptionCategory(" 12", "critical"); + exemptionCategoryFieldsValidator.validate(exemptionCategory); + + } + +}