/*******************************************************************************
 * Copyright (c) 2014 Jens Reimann.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Jens Reimann - initial API and implementation
 *******************************************************************************/
package de.dentrassi.osgi.web.test;

import java.lang.reflect.Method;

import org.junit.Assert;
import org.junit.Test;

import de.dentrassi.osgi.web.controller.Controllers;
import de.dentrassi.osgi.web.controller.routing.RequestMappingInformation;

public class ControllersTest
{
    @Test
    public void testA () throws NoSuchMethodException, SecurityException
    {
        testMethod ( "mainA", new String[] { "/a" }, "GET" );
    }

    @Test
    public void testB () throws NoSuchMethodException, SecurityException
    {
        testMethod ( "mainB", new String[] { "/a/b" }, "GET" );
    }

    protected void testMethod ( final String name, final String[] expectedPaths, final String httpMethod ) throws NoSuchMethodException
    {
        final Method m = TestController.class.getMethod ( name );
        final RequestMappingInformation rmi = Controllers.fromMethod ( m );

        Assert.assertNotNull ( "No mapping information", rmi );

        for ( final String p : expectedPaths )
        {
            Assert.assertNotNull ( "No match for: " + p, rmi.matches ( p, httpMethod ) );
        }
    }
}

add missing test file