@Test public void testDestroy() { final ManagedInstance managedInstance = mock(ManagedInstance.class); final Object control = mock(Object.class); final Consumer<Object> consumer = mock(Consumer.class); InstanceUtils.destroy(managedInstance, control, consumer); verify(consumer, times(1)).accept(eq(control)); verify(managedInstance, times(1)).destroy(eq(control)); }
public static <T> void destroy(final ManagedInstance<T> controlInstance, final T control, final Consumer<T> destroyer) { destroyer.accept(control); controlInstance.destroy(control); }
InstanceUtils { public static <T> void destroy(final ManagedInstance<T> controlInstance, final T control, final Consumer<T> destroyer) { destroyer.accept(control); controlInstance.destroy(control); } }
InstanceUtils { public static <T> void destroy(final ManagedInstance<T> controlInstance, final T control, final Consumer<T> destroyer) { destroyer.accept(control); controlInstance.destroy(control); }  }
InstanceUtils { public static <T> void destroy(final ManagedInstance<T> controlInstance, final T control, final Consumer<T> destroyer) { destroyer.accept(control); controlInstance.destroy(control); }  @SuppressWarnings("unchecked") static T lookup(final ManagedInstance instance,
                               final Class<T> type,
                               final Annotation... qualifier); static T lookup(final ManagedInstance<T> instance,
                               final Annotation qualifier); static void destroyAll(final List<ManagedInstance<T>> controlInstances,
                                      final List<T> controls,
                                      final Consumer<T> destroyer); static void destroy(final ManagedInstance<T> controlInstance,
                                   final T control,
                                   final Consumer<T> destroyer); }
InstanceUtils { public static <T> void destroy(final ManagedInstance<T> controlInstance, final T control, final Consumer<T> destroyer) { destroyer.accept(control); controlInstance.destroy(control); }  @SuppressWarnings("unchecked") static T lookup(final ManagedInstance instance,
                               final Class<T> type,
                               final Annotation... qualifier); static T lookup(final ManagedInstance<T> instance,
                               final Annotation qualifier); static void destroyAll(final List<ManagedInstance<T>> controlInstances,
                                      final List<T> controls,
                                      final Consumer<T> destroyer); static void destroy(final ManagedInstance<T> controlInstance,
                                   final T control,
                                   final Consumer<T> destroyer);  }