home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (EnsureClassAnnotationPresentInStubTest.groovy)

This example Groovy source code file (EnsureClassAnnotationPresentInStubTest.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

bar, ensureclassannotationpresentinstubtest, ensureclassannotationpresentinstubtest, foo, foo, map, override, override, string, string, stringsourcesstubtestcase, target

The Groovy EnsureClassAnnotationPresentInStubTest.groovy source code

package org.codehaus.groovy.tools.stubgenerator

/**
 * @author Guillaume Laforge
 */
class EnsureClassAnnotationPresentInStubTest extends StringSourcesStubTestCase {
    @Override
    Map<String, String> provideSources() {
        [
                'Foo.java': '''
                    package foo;

                    import java.lang.annotation.ElementType;
                    import java.lang.annotation.Retention;
                    import java.lang.annotation.RetentionPolicy;
                    import java.lang.annotation.Target;

                    @Retention(RetentionPolicy.RUNTIME)
                    @Target({ElementType.TYPE})
                    public @interface Foo {}
                ''',

                'bar/Bar.groovy': '''
                    package bar

                    import foo.Foo
                    @Foo
                    class Bar {}
                '''
        ]
    }

    @Override
    void verifyStubs() {
        assert classes['bar.Bar'].annotations[0].type.toString() == 'foo.Foo'
    }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy EnsureClassAnnotationPresentInStubTest.groovy source code file:

new blog posts

 

Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.