001/**
002 * Copyright 2015 DuraSpace, Inc.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.fcrepo.webapp;
017
018import org.junit.Assert;
019import org.fcrepo.kernel.api.exception.ConstraintViolationException;
020import org.junit.Test;
021import org.reflections.Reflections;
022
023import java.io.File;
024import java.util.Set;
025
026/**
027 * @author awoods
028 * @since 6/25/15
029 */
030public class ConstraintExceptionsTest {
031
032    @Test
033    public void testConstraintRdfExists() {
034        final Reflections reflections = new Reflections("org.fcrepo");
035        final Set<Class<? extends ConstraintViolationException>> subTypes =
036                reflections.getSubTypesOf(ConstraintViolationException.class);
037
038        subTypes.add(ConstraintViolationException.class);
039
040        for (final Class c : subTypes) {
041            final File file = new File("src/main/webapp/static/constraints/" + c.getSimpleName() + ".rdf");
042            Assert.assertTrue("Expected to find: " + file.getPath(), file.exists());
043        }
044    }
045
046}