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
This commit is contained in:
Oana Nechiforescu
2015-06-24 07:58:15 +00:00
parent 708b7bd0d4
commit 8ca5dda4a4

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}