Package com.knappsack.swagger4springweb.parser

Source Code of com.knappsack.swagger4springweb.parser.ApiParameterParserTest

package com.knappsack.swagger4springweb.parser;

import com.knappsack.swagger4springweb.AbstractTest;
import com.knappsack.swagger4springweb.testController.MockController;
import com.wordnik.swagger.model.Model;
import com.wordnik.swagger.model.Parameter;
import org.junit.Test;

import java.lang.reflect.Method;
import java.util.*;

import static junit.framework.Assert.assertTrue;

public class ApiParameterParserTest extends AbstractTest {

    @Test
    public void documentationParameterTest() throws NoSuchMethodException {
        Class controllerClass = MockController.class;
        Method method = controllerClass
                .getMethod("getTestPojoRequestParams", String.class, Boolean.class, Byte.class, Long.class,
                        Integer.class, Float.class, Double.class, Date.class);
        ApiParameterParser parameterParser = new ApiParameterParser(new ArrayList<String>(),
                new HashMap<String, Model>());
        List<Parameter> documentationParameters = parameterParser.parseApiParametersAndArgumentModels(method);
        assertTrue(documentationParameters.size() == 8);
        Parameter documentationParameter = documentationParameters.get(0);
        assertTrue(documentationParameter.dataType().equals("string"));
        assertTrue(documentationParameter.name().equals("testVariable"));
    }

}
TOP

Related Classes of com.knappsack.swagger4springweb.parser.ApiParameterParserTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.