EjbModule module = new EjbModule(new EjbJar());
StatelessBean bean = module.getEjbJar().addEnterpriseBean(new StatelessBean("CheeseEjb", "org.acme.CheeseEjb"));
// Valid
EnvEntry envEntry = new EnvEntry("count", Integer.class.getName(), "10");
envEntry.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/count"));
bean.getEnvEntry().add(envEntry);
// Invalid
EnvEntry envEntry2 = new EnvEntry("color", String.class.getName(), "yellow");
envEntry2.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "org.acme.CheeseEjb/setColor"));
bean.getEnvEntry().add(envEntry2);
// Invalid
EnvEntry envEntry3 = new EnvEntry("age", Integer.class.getName(), "5");
envEntry3.getInjectionTarget().add(new InjectionTarget("org.acme.CheeseEjb", "setAge"));
bean.getEnvEntry().add(envEntry3);
CheckInjectionTargets rule = new CheckInjectionTargets();
rule.module = module;
rule.validate(module);