use of jodd.madvoc.scope.ParamsScope in project jodd by oblac.
the class MadvocParamsInjectorTest method testInjection.
@Test
void testInjection() {
WebApp webapp = new WebApp();
webapp.start();
PetiteContainer madpc = webapp.madvocContainer().getPetiteContainer();
String baseName = StringUtil.uncapitalize(FooBean.class.getSimpleName());
madpc.defineParameter("foo", "1");
madpc.defineParameter(baseName + ".integer", "173");
madpc.defineParameter(baseName + ".string", "jodd");
madpc.defineParameter(baseName, "huh");
ParamsScope paramsScope = new ParamsScope();
BeanUtil.declared.setProperty(paramsScope, "madpc", madpc);
FooBean fooBean = new FooBean();
paramsScope.inject(new Targets(fooBean, null));
assertEquals(173, fooBean.getInteger().intValue());
assertEquals("jodd", fooBean.getString());
}
Aggregations