Package ch.nerdin.generators.testdata.framework.annotation

Examples of ch.nerdin.generators.testdata.framework.annotation.CreateTestData


        catalog.loadCatalog();
    }

    public Object instantiateBeans(Method method) {
        Object createObject;
        CreateTestData testData = getAnnotation(method);
        int randomSize = randomUtil.randomBetween(testData.min(), testData.max());

        if (Collection.class.isAssignableFrom(method.getReturnType())) {
            Collection collection = newInstance(testData.collectionType());
            for (int i = 0; i < randomSize; i++) {
                collection.add(instantiateBean(method));
            }

            createObject = collection;
        } else if (Map.class.isAssignableFrom(method.getReturnType())) {
            Map map = newInstance(testData.mapType());
            for (int i = 0; i < randomSize; i++) {
                Class<?>[] types = findReturnType(method);
                map.put(instantiateType(types[0]), instantiateType(types[1]));
            }
            createObject = map;
View Full Code Here

TOP

Related Classes of ch.nerdin.generators.testdata.framework.annotation.CreateTestData

Copyright © 2018 www.massapicom. 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.