Package us.codecraft.forger.property

Examples of us.codecraft.forger.property.AnnotationPropertyLoader


        assertThat(foo.getFoo()).isEqualTo("test");
    }

    @Test
      public void testForgerCreateByClassAnnotation() throws Exception {
        ForgerFactory forgerFactory = new ForgerFactory(new AnnotationPropertyLoader(), null);
        Forger<Foo> forger = forgerFactory.<Foo>create(Foo.class);
        Foo foo = forger.forge(ImmutableMap.<String, Object>of("fooa", "test"));
        assertThat(foo.getFoo()).isEqualTo("test");
    }
View Full Code Here


        assertThat(foo.getFoo()).isEqualTo("test");
    }

    @Test
    public void testForgerCreateByClassAnnotationCompile() throws Exception {
        ForgerFactory forgerFactory = new ForgerFactory(new AnnotationPropertyLoader(), new GroovyForgerCompiler());
        Forger<Fooable> forger = forgerFactory.<Fooable>compile(Foo.SOURCE_CODE);
        Fooable foo = forger.forge(ImmutableMap.<String, Object>of("fooa", "test"));
        Field field = forger.getClazz().getDeclaredField("foo");
        field.setAccessible(true);
        assertThat(field.get(foo)).isEqualTo("test");
View Full Code Here

        assertThat(foo.foo()).isEqualTo("test");
    }

    @Test
    public void testForgerCreateByClassAnnotationWithCollections() throws Exception {
        ForgerFactory forgerFactory = new ForgerFactory(new AnnotationPropertyLoader(), null);
        Forger<Bar> forger = forgerFactory.<Bar>create(Bar.class);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("bar", "bar");
        Map<String, String> submap = new HashMap<String, String>();
        submap.put("1", "1");
View Full Code Here

TOP

Related Classes of us.codecraft.forger.property.AnnotationPropertyLoader

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.