@Test
public void shouldRetrieveAllThePlugins() throws Exception {

    registry.put("test", plugin);
    registry.put("optional", optionalPlugin);
    final List<PluginRef> all = (List<PluginRef>) context.getAllPlugins();
    assertFalse(all.isEmpty());
    for (int i = 0; i < all.size(); i++) {
        switch (i) {
            case 0: {
                final PluginRef ref = all.get(i);
                assertEquals("test", ref.getName());
                assertEquals(plugin, ref.get());
                assertEquals(TestPlugin.class, ref.getType());
                break;
            }
            case 1: {
                final PluginRef ref = all.get(i);
                assertEquals("optional", ref.getName());
                assertEquals(optionalPlugin, ref.get());
                assertEquals(OptionalPlugin.class, ref.getType());
                break;
            }
        }
    }
}