Package com.pogofish.jadt.sink

Examples of com.pogofish.jadt.sink.StringSink


        final Constructor constructor = new Constructor(NO_COMMENTS, "Foo", list(
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("Integer", Util.<RefType>list())), "um"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType>list())), "yeah")
        ));
       
        final StringSink sink = new StringSink("test");
        try {
           
            emitter.emitToString(sink, "    ", constructor);
        } finally {
            sink.close();           
        }
        assertEquals(ARGS_TO_STRING, sink.result());        
    }
View Full Code Here


     */
    @Test
    public void testNoArgsNoTypesEquals() {
        final Constructor constructor = new Constructor(NO_COMMENTS, "Whatever", Util.<Arg>list());
       
        final StringSink sink = new StringSink("test");
        try {
           
            emitter.emitEquals(sink, "    ", constructor, Util.<String>list());
        } finally {
            sink.close();           
        }
        assertEquals(NO_ARG_EQUALS, sink.result());                
    }
View Full Code Here

                new Arg(Util.<ArgModifier>list(), _Primitive(_IntType()), "um"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType>list())), "yeah"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ArrayType(_Primitive(_IntType()))), "oh")
        ));
       
        final StringSink sink = new StringSink("test");
        try {
           
            emitter.emitEquals(sink, "    ", constructor, Util.<String>list());
        } finally {
            sink.close();           
        }
        assertEquals(ARGS_NO_TYPES_EQUALS, sink.result());                
    }
View Full Code Here

                new Arg(Util.<ArgModifier>list(), _Primitive(_IntType()), "um"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType>list())), "yeah"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ArrayType(_Primitive(_IntType()))), "oh")
        ));
       
        final StringSink sink = new StringSink("test");
        try {
           
            emitter.emitEquals(sink, "    ", constructor, list("A", "B"));
        } finally {
            sink.close();           
        }
        assertEquals(ARGS_TYPES_EQUALS, sink.result());                
    }
View Full Code Here

     */
    @Test
    public void testNoArgHashCode() {
        final Constructor constructor = new Constructor(NO_COMMENTS, "Whatever", Util.<Arg>list());
       
        final StringSink sink = new StringSink("test");
        try {
           
            emitter.emitHashCode(sink, "    ", constructor);
        } finally {
            sink.close();           
        }
        assertEquals(NO_ARG_HASHCODE, sink.result());                
       
    }
View Full Code Here

                new Arg(Util.<ArgModifier>list(), _Primitive(_DoubleType()), "yourPleasure"),
                               new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType>list())), "yeah"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ArrayType(_Primitive(_IntType()))), "oh")
        ));
       
        final StringSink sink = new StringSink("test");
        try {           
            emitter.emitHashCode(sink, "    ", constructor);
        } finally {
            sink.close();           
        }
        assertEquals(ARGS_HASHCODE, sink.result());                
       
    }   
View Full Code Here

        final DataType fooBar = new DataType(Util.list(_JavaDocComment("/**", list(_JDWhiteSpace(" "), _JDWord("hello"), _JDWhiteSpace(" ")), Util.<JDTagSection>list(), "*/")), ANNOTATIONS, "FooBar", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(
                new Constructor(NO_COMMENTS, "Foo", list(new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("Integer", Util.<RefType> list())), "yeah"),
                        new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType> list())), "hmmm"))), new Constructor(NO_COMMENTS, "Bar",
                        Util.<Arg> list())));

        final StringSink sink = new StringSink("test");
        try {
            final DataTypeEmitter emitter = new StandardDataTypeEmitter(new DummyClassBodyEmitter(),
                    new DummyConstructorEmitter());

            emitter.emit(sink, fooBar, HEADER);
        } finally {
            sink.close();
        }
        assertEquals(HEADER + MULTI_HEADER_NO_BASE + MULTI_CONSTRUCTOR_NO_BASE, sink.result());
    }
View Full Code Here

        final DataType fooBar = new DataType(Util.list(_JavaDocComment("/**", list(_JDWhiteSpace(" "), _JDWord("hello"), _JDWhiteSpace(" ")), Util.<JDTagSection>list(), "*/")), ANNOTATIONS, "FooBar", Util.<String>list(), _Some(_ClassType("FooA", NO_TYPE_ARGS)), list(_ClassType("FooB", NO_TYPE_ARGS), _ClassType("FooC", NO_TYPE_ARGS)), list(
                new Constructor(NO_COMMENTS, "Foo", list(new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("Integer", Util.<RefType> list())), "yeah"),
                        new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType> list())), "hmmm"))), new Constructor(NO_COMMENTS, "Bar",
                        Util.<Arg> list())));

        final StringSink sink = new StringSink("test");
        try {
            final DataTypeEmitter emitter = new StandardDataTypeEmitter(new DummyClassBodyEmitter(),
                    new DummyConstructorEmitter());

            emitter.emit(sink, fooBar, HEADER);
        } finally {
            sink.close();
        }
        assertEquals(HEADER + MULTI_HEADER_WITH_BASE + MULTI_CONSTRUCTOR_WITH_BASE, sink.result());
    }
View Full Code Here

    public void testSingleConstructorNoBase() {
        final DataType fooBar = new DataType(Util.list(_JavaDocComment("/**", list(_JDWhiteSpace(" "), _JDWord("hello"), _JDWhiteSpace(" ")), Util.<JDTagSection>list(), "*/")), ANNOTATIONS, "FooBar", Util.<String>list(), NO_EXTENDS, NO_IMPLEMENTS, list(new Constructor(NO_COMMENTS, "Foo", list(
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("Integer", Util.<RefType> list())), "yeah"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType> list())), "hmmm")))));

        final StringSink sink = new StringSink("test");
        try {
            final DataTypeEmitter emitter = new StandardDataTypeEmitter(new DummyClassBodyEmitter(),
                    new DummyConstructorEmitter());

            emitter.emit(sink, fooBar, HEADER);
        } finally {
            sink.close();
        }
        assertEquals(HEADER + SINGLE_HEADER_NO_BASE + SINGLE_CONSTRUCTOR_NO_BASE, sink.result());
    }
View Full Code Here

    public void testSingleConstructorWithBase() {
        final DataType fooBar = new DataType(Util.list(_JavaDocComment("/**", list(_JDWhiteSpace(" "), _JDWord("hello"), _JDWhiteSpace(" ")), Util.<JDTagSection>list(), "*/")), ANNOTATIONS, "FooBar", Util.<String>list(), _Some(_ClassType("FooA", NO_TYPE_ARGS)), list(_ClassType("FooB", NO_TYPE_ARGS), _ClassType("FooC", NO_TYPE_ARGS)), list(new Constructor(NO_COMMENTS, "Foo", list(
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("Integer", Util.<RefType> list())), "yeah"),
                new Arg(Util.<ArgModifier>list(), _Ref(_ClassType("String", Util.<RefType> list())), "hmmm")))));

        final StringSink sink = new StringSink("test");
        try {
            final DataTypeEmitter emitter = new StandardDataTypeEmitter(new DummyClassBodyEmitter(),
                    new DummyConstructorEmitter());

            emitter.emit(sink, fooBar, HEADER);
        } finally {
            sink.close();
        }
        assertEquals(HEADER + SINGLE_HEADER_WITH_BASE + SINGLE_CONSTRUCTOR_WITH_BASE, sink.result());
    }
View Full Code Here

TOP

Related Classes of com.pogofish.jadt.sink.StringSink

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.