use of org.nutz.ioc.json.pojo.IocTO00 in project nutz by nutzam.
the class SimpleJsonIocTest method test_2darray_iocvalue.
@Test
public void test_2darray_iocvalue() {
Ioc ioc = I("obj:{args:[[['a','b'],['c','d']]]}");
IocTO00 obj = ioc.get(IocTO00.class, "obj");
assertEquals(2, obj.getStrss().length);
assertEquals(2, obj.getStrss()[0].length);
assertEquals("a", obj.getStrss()[0][0]);
assertEquals("b", obj.getStrss()[0][1]);
assertEquals("c", obj.getStrss()[1][0]);
assertEquals("d", obj.getStrss()[1][1]);
}
use of org.nutz.ioc.json.pojo.IocTO00 in project nutz by nutzam.
the class SimpleJsonIocTest method test_2darray_by_map_iocvalue.
@Test
public void test_2darray_by_map_iocvalue() {
Map<String, Map<String, Object>> map = new HashMap<String, Map<String, Object>>();
Map<String, Object> objMap = new HashMap<String, Object>();
String[][] strss = new String[2][2];
strss[0][0] = "a";
strss[0][1] = "b";
strss[1][0] = "c";
strss[1][1] = "d";
objMap.put("args", new Object[] { strss });
map.put("obj", objMap);
Ioc ioc = new NutIoc(new MapLoader(map));
IocTO00 obj = ioc.get(IocTO00.class, "obj");
assertEquals(2, obj.getStrss().length);
assertEquals(2, obj.getStrss()[0].length);
assertEquals("a", obj.getStrss()[0][0]);
assertEquals("b", obj.getStrss()[0][1]);
assertEquals("c", obj.getStrss()[1][0]);
assertEquals("d", obj.getStrss()[1][1]);
ioc.depose();
}