Package com.pogofish.jadt.ast

Examples of com.pogofish.jadt.ast.DataType


     * Check with duplicate data types
     */
    @Test
    public void testDuplicateDataType() {
        final Checker checker = new StandardChecker();
        final DataType dataType = new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(new Constructor(NO_COMMENTS, "Foo", Util.<Arg>list())));
        final Doc doc = new Doc("CheckerTest", Pkg._Pkg(NO_COMMENTS, ""), NO_IMPORTS, list(dataType, dataType));
        final List<SemanticError> errors = checker.check(doc);
        assertEquals(1, errors.size());
        assertTrue(errors.contains(_DuplicateDataType(dataType.name)));
    }
View Full Code Here


        // package and imports
        assertEquals("package some.package\n\nimport number.one\nimport number.two\n\n", print(new Doc(
                "PrinterTest", Pkg._Pkg(NO_COMMENTS, "some.package"), list(Imprt._Imprt(NO_COMMENTS, "number.one"), Imprt._Imprt(NO_COMMENTS,"number.two")), Util.<DataType> list())));
        // package, imports and datatypes
        assertEquals("package some.package\n\nimport number.one\nimport number.two\n\nFoo =\n    Bar\n", print(new Doc(
                "PrinterTest", Pkg._Pkg(NO_COMMENTS, "some.package"), list(Imprt._Imprt(NO_COMMENTS, "number.one"), Imprt._Imprt(NO_COMMENTS,"number.two")), list(new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS,
                        list(new Constructor(NO_COMMENTS, "Bar", Util.<Arg> list())))))));
    }
View Full Code Here

     */
    @Test
    public void testDuplicateConstructor() {
        final Checker checker = new StandardChecker();
        final Constructor constructor = new Constructor(NO_COMMENTS, "Bar", Util.<Arg>list());
        final DataType dataType = new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(constructor, constructor));
        final Doc doc = new Doc("CheckerTest", Pkg._Pkg(NO_COMMENTS, ""), NO_IMPORTS, list(dataType));
        final List<SemanticError> errors = checker.check(doc);
        assertEquals(1, errors.size());
        assertTrue(errors.contains(_DuplicateConstructor(dataType.name, constructor.name)));
    }
View Full Code Here

    @Test
    public void testConstructorDataTypeConflict() {
        final Checker checker = new StandardChecker();
        final Constructor constructor1 = new Constructor(NO_COMMENTS, "Bar", Util.<Arg>list());
        final Constructor constructor2 = new Constructor(NO_COMMENTS, "Foo", Util.<Arg>list());
        final DataType dataType = new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(constructor1, constructor2));
        final Doc doc = new Doc("CheckerTest", Pkg._Pkg(NO_COMMENTS, ""), NO_IMPORTS, list(dataType));
        final List<SemanticError> errors = checker.check(doc);
        assertEquals(1, errors.size());
        assertTrue(errors.contains(_ConstructorDataTypeConflict(dataType.name)));
    }
View Full Code Here

   
    @Test
    public void testDuplicateArgName() {
        final Checker checker = new StandardChecker();
        final Constructor constructor = new Constructor(NO_COMMENTS, "Bar", list(Arg._Arg(Util.<ArgModifier>list(), Type._Primitive(PrimitiveType._IntType()), "foo"), Arg._Arg(Util.<ArgModifier>list(), Type._Primitive(PrimitiveType._BooleanType()), "foo")));
        final DataType dataType = new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(constructor));
        final Doc doc = new Doc("CheckerTest", Pkg._Pkg(NO_COMMENTS, ""), NO_IMPORTS, list(dataType));
        final List<SemanticError> errors = checker.check(doc);
        assertEquals(1, errors.size());
        assertTrue(errors.contains(_DuplicateArgName(dataType.name, constructor.name, "foo")));      
    }
View Full Code Here

   
    @Test
    public void testDuplicateArgModifier() {
        final Checker checker = new StandardChecker();
        final Constructor constructor = new Constructor(NO_COMMENTS, "Bar", list(Arg._Arg(list(ArgModifier._Final(), ArgModifier._Final()), Type._Primitive(PrimitiveType._IntType()), "foo")));
        final DataType dataType = new DataType(NO_COMMENTS, NO_ANNOTATIONS, "Foo", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(constructor));
        final Doc doc = new Doc("CheckerTest", Pkg._Pkg(NO_COMMENTS, ""), NO_IMPORTS, list(dataType));
        final List<SemanticError> errors = checker.check(doc);
        assertEquals(1, errors.size());
        assertTrue(errors.contains(_DuplicateModifier(dataType.name, constructor.name, "foo", "final")));      
    }          
View Full Code Here

TOP

Related Classes of com.pogofish.jadt.ast.DataType

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.