Package com.thoughtworks.qdox.parser.structs

Examples of com.thoughtworks.qdox.parser.structs.ClassDef


        assertEquals("final", modifiers[0]);
        assertEquals("public", modifiers[1]);
    }

    public void testAddMethodsToCorrectClass() throws Exception {
        builder.beginClass(new ClassDef());
        builder.addMethod(new MethodDef());
        builder.endClass();

        builder.beginClass(new ClassDef());
        builder.addMethod(new MethodDef());
        builder.addMethod(new MethodDef());
        builder.addMethod(new MethodDef());
        builder.endClass();

        builder.beginClass(new ClassDef());
        builder.addMethod(new MethodDef());
        builder.addMethod(new MethodDef());
        builder.endClass();

        JavaSource source = builder.getSource();
View Full Code Here


    }

    public void testInnerClass() throws Exception {
        builder.addPackage("xyz");

        ClassDef outerDef = new ClassDef();
        outerDef.name = "Outer";
        builder.beginClass(outerDef);

        ClassDef innerDef = new ClassDef();
        innerDef.name = "Inner";
        builder.beginClass(innerDef);

        MethodDef fooDef = new MethodDef();
        fooDef.name = "foo";
View Full Code Here

        assertEquals(1, innerClass.getMethods().length);
        assertEquals("foo", innerClass.getMethods()[0].getName());
    }

    public void testSimpleMethod() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        builder.addMethod(mth);
        builder.endClass();
View Full Code Here

        assertEquals(0, doSomething.getParameters().length);
        assertEquals(0, doSomething.getExceptions().length);
    }

    public void testMethodNoArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 0;
        builder.addMethod(mth);
View Full Code Here

        JavaMethod result = source.getClasses()[0].getMethods()[0];
        assertEquals(0, result.getReturns().getDimensions());
    }

    public void testMethod1dArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 1;
        builder.addMethod(mth);
View Full Code Here

        JavaMethod result = source.getClasses()[0].getMethods()[0];
        assertEquals(1, result.getReturns().getDimensions());
    }

    public void testMethod2dArray() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        mth.dimensions = 2;
        builder.addMethod(mth);
View Full Code Here

        JavaMethod result = source.getClasses()[0].getMethods()[0];
        assertEquals(2, result.getReturns().getDimensions());
    }

    public void testMethodParameters() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        FieldDef f1 = new FieldDef();
        f1.name = "count";
        f1.type = "int";
View Full Code Here

        assertEquals("name", result.getParameters()[1].getName());
        assertEquals("String", result.getParameters()[1].getType().getValue());
    }

    public void testMethodParametersWithArrays() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        FieldDef f1 = new FieldDef();
        f1.name = "count";
        f1.type = "int";
View Full Code Here

        assertEquals(1, result.getParameters()[0].getType().getDimensions());
        assertEquals(2, result.getParameters()[1].getType().getDimensions());
    }

    public void testMethodExceptions() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        mth.exceptions.add("RuntimeException");
        mth.exceptions.add("java.io.IOException");
View Full Code Here

        assertEquals("RuntimeException", result.getExceptions()[0].getValue());
        assertEquals("java.io.IOException", result.getExceptions()[1].getValue());
    }

    public void testMethodModifiers() throws Exception {
        builder.beginClass(new ClassDef());
        MethodDef mth = new MethodDef();

        mth.modifiers.add("public");
        mth.modifiers.add("final");
        mth.modifiers.add("synchronized");
View Full Code Here

TOP

Related Classes of com.thoughtworks.qdox.parser.structs.ClassDef

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.