// Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
// 
//     private final T ref;
//     private final String name;
//     private final Class<T> type;
// 
//     private PluginRef(T ref, String name, Class<T> type) {
//         this.ref = Objects.requireNonNull(ref, "Plugin reference cannot be null");
//         this.name = Objects.requireNonNull(name, "Plugin name cannot be null");
//         this.type = Objects.requireNonNull(type, "Plugin type cannot be null");
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <T> PluginRef<T> of(T ref, String name) {
//         return new PluginRef<>(ref, name, (Class<T>) ref.getClass());
//     }
// 
//     public T get() {
//         return ref;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Class<T> getType() {
//         return type;
//     }
// 
// 
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/OptionalPlugin.java
// @Plugin(name = "optional")
// public class OptionalPlugin {
// 
//     public String greet() {
//         return "Hello PlugFace!";
//     }
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestInterface.java
// public interface TestInterface {
// 
//     String greet();
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestPlugin.java
// @Plugin(name = "test")
// public class TestPlugin extends TestSuperclass {
// 
//     @Override
//     public String greet() {
//         return "Hello PlugFace!";
//     }
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestSuperclass.java
// public abstract class TestSuperclass implements TestInterface{
// }


import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import org.plugface.core.PluginRef;

    @Test
    public void shouldRetrievePluginFromClass() {
        registry.put("test", plugin);
        final TestPlugin test = context.getPlugin(TestPlugin.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrievePluginFromInterface() {
        registry.put("test", plugin);
        final TestInterface test = context.getPlugin(TestInterface.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrievePluginFromSuperclass() {
        registry.put("test", plugin);
        final TestSuperclass test = context.getPlugin(TestSuperclass.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrieveAllThePlugins() throws Exception {
        registry.put("test", plugin);
        registry.put("optional", optionalPlugin);

// Path: plugface-core/src/main/java/org/plugface/core/PluginRef.java
// public final class PluginRef<T> {
// 
//     private final T ref;
//     private final String name;
//     private final Class<T> type;
// 
//     private PluginRef(T ref, String name, Class<T> type) {
//         this.ref = Objects.requireNonNull(ref, "Plugin reference cannot be null");
//         this.name = Objects.requireNonNull(name, "Plugin name cannot be null");
//         this.type = Objects.requireNonNull(type, "Plugin type cannot be null");
//     }
// 
//     @SuppressWarnings("unchecked")
//     public static <T> PluginRef<T> of(T ref, String name) {
//         return new PluginRef<>(ref, name, (Class<T>) ref.getClass());
//     }
// 
//     public T get() {
//         return ref;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Class<T> getType() {
//         return type;
//     }
// 
// 
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/OptionalPlugin.java
// @Plugin(name = "optional")
// public class OptionalPlugin {
// 
//     public String greet() {
//         return "Hello PlugFace!";
//     }
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestInterface.java
// public interface TestInterface {
// 
//     String greet();
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestPlugin.java
// @Plugin(name = "test")
// public class TestPlugin extends TestSuperclass {
// 
//     @Override
//     public String greet() {
//         return "Hello PlugFace!";
//     }
// }
// 
// Path: plugface-core/src/test/java/org/plugface/core/plugins/TestSuperclass.java
// public abstract class TestSuperclass implements TestInterface{
// }


// Path: plugface-core/src/test/java/org/plugface/core/impl/DefaultPluginContextTest.java
import org.plugface.core.plugins.OptionalPlugin;
import org.plugface.core.plugins.TestInterface;
import org.plugface.core.plugins.TestPlugin;
import org.plugface.core.plugins.TestSuperclass;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import org.plugface.core.PluginRef;


    @Test
    public void shouldRetrievePluginFromClass() {
        registry.put("test", plugin);
        final TestPlugin test = context.getPlugin(TestPlugin.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrievePluginFromInterface() {
        registry.put("test", plugin);
        final TestInterface test = context.getPlugin(TestInterface.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrievePluginFromSuperclass() {
        registry.put("test", plugin);
        final TestSuperclass test = context.getPlugin(TestSuperclass.class);
        assertTrue(registry.containsKey("test"));
        assertEquals(plugin, test);
    }

    @Test
    public void shouldRetrieveAllThePlugins() throws Exception {
        registry.put("test", plugin);
        registry.put("optional", optionalPlugin);

        final List<PluginRef> all = (List<PluginRef>) context.getAllPlugins();