EffectorUtils { public static Maybe<Effector<?>> findEffector(Collection<? extends Effector<?>> effectors, String effectorName) { for (Effector<?> effector : effectors) { if (effector.getName().equals(effectorName)) { return Maybe.<Effector<?>>of(effector); } } return Maybe.absent(new NoSuchElementException("No effector with name "+effectorName+" (contenders "+effectors+")")); }  static Object[] prepareArgsForEffector(Effector<?> eff, Object[] args); static Object[] prepareArgsForEffector(Effector<?> eff, Map<?,?> args); @Deprecated static Object[] prepareArgsForEffector(Effector<?> eff, Object args); static Map prepareArgsForEffectorAsMapFromArray(Effector<?> eff, Object args[]); static Object[] oldPrepareArgsForEffector(Effector<?> eff, Object args); static T invokeMethodEffector(Entity entity, Effector<T> eff, Map<String,?> args); static RuntimeException handleEffectorException(Entity entity, Effector<?> effector, Throwable throwable); static Task<T> invokeEffectorAsync(Entity entity, Effector<T> eff, Map<String,?> parameters); static Maybe<Effector<?>> findEffector(Collection<? extends Effector<?>> effectors, String effectorName); static Maybe<Effector<?>> findEffectorDeclared(Entity entity, String effectorName); static Map<Object,Object> getTaskFlagsForEffectorInvocation(Entity entity, Effector<?> effector, ConfigBag parameters);  }
@Test public void testFindEffector() { Maybe<Effector<?>> found = EffectorUtils.findEffector(ImmutableList.of(effector), "myEffector"); assertEquals(found.get(), effector); Maybe<Effector<?>> notFound = EffectorUtils.findEffector(ImmutableList.of(effector), "wrongEffectorName"); assertFalse(notFound.isPresent(), notFound.toString()); }