use of org.nutz.ioc.json.pojo.Animal in project nutz by nutzam.
the class SimpleJsonIocTest method test_refer_self.
@Test
public void test_refer_self() {
Ioc ioc = I(J("fox", "name:'Fox',another:{refer:'fox'}"));
Animal f = ioc.get(Animal.class, "fox");
assertEquals("Fox", f.getName());
assertTrue(f == f.getAnother());
}
use of org.nutz.ioc.json.pojo.Animal in project nutz by nutzam.
the class SimpleJsonIocTest method test_normal.
@Test
public void test_normal() {
Animal a = A("age:23,name:'monkey',race:'MAMMAL'");
assertEquals(23, a.getAge());
assertEquals("monkey", a.getName());
assertEquals(AnimalRace.MAMMAL, a.getRace());
}
use of org.nutz.ioc.json.pojo.Animal in project nutz by nutzam.
the class SimpleJsonIocTest method test_muilt_parent.
@Test
public void test_muilt_parent() {
Ioc ioc = I(J("fox", "name:'P',age:10"), J("f2", "parent:'fox'"), J("f3", "parent:'f2'"));
Animal f3 = ioc.get(Animal.class, "f3");
assertEquals(10, f3.getAge());
}
use of org.nutz.ioc.json.pojo.Animal in project nutz by nutzam.
the class SimpleJsonIocTest method test_parent.
@Test
public void test_parent() {
Ioc ioc = I(J("fox", "name:'P',age:10"), J("f2", "parent:'fox',fields:{age:5}"));
Animal fox = ioc.get(Animal.class, "fox");
assertEquals("P", fox.getName());
assertEquals(10, fox.getAge());
Animal f2 = ioc.get(Animal.class, "f2");
assertEquals("P", f2.getName());
assertEquals(5, f2.getAge());
}
use of org.nutz.ioc.json.pojo.Animal in project nutz by nutzam.
the class SimpleJsonIocTest method test_java_simple.
@Test
public void test_java_simple() {
Ioc ioc = I(J("fox", "name:{java: '@Name.toUpperCase()'}, age:{java:'@Name.length()'}"));
Animal fox = ioc.get(Animal.class, "fox");
assertEquals("FOX", fox.getName());
assertEquals(3, fox.getAge());
}
Aggregations