Search in sources :

Example 1 with RuneLite

use of net.runelite.client.RuneLite in project runelite by runelite.

the class PluginManagerTest method before.

@Before
public void before() throws IOException {
    RuneLite.setOptions(mock(OptionSet.class));
    Injector injector = Guice.createInjector(new RuneLiteModule(), BoundFieldModule.of(this));
    RuneLite.setInjector(injector);
    runelite = injector.getInstance(RuneLite.class);
    // Find plugins we expect to have
    pluginClasses = new HashSet<>();
    Set<ClassInfo> classes = ClassPath.from(getClass().getClassLoader()).getTopLevelClassesRecursive(PLUGIN_PACKAGE);
    for (ClassInfo classInfo : classes) {
        Class<?> clazz = classInfo.load();
        PluginDescriptor pluginDescriptor = clazz.getAnnotation(PluginDescriptor.class);
        if (pluginDescriptor != null) {
            pluginClasses.add(clazz);
        }
    }
}
Also used : Injector(com.google.inject.Injector) RuneLite(net.runelite.client.RuneLite) OptionSet(joptsimple.OptionSet) RuneLiteModule(net.runelite.client.RuneLiteModule) ClassInfo(com.google.common.reflect.ClassPath.ClassInfo) Before(org.junit.Before)

Aggregations

ClassInfo (com.google.common.reflect.ClassPath.ClassInfo)1 Injector (com.google.inject.Injector)1 OptionSet (joptsimple.OptionSet)1 RuneLite (net.runelite.client.RuneLite)1 RuneLiteModule (net.runelite.client.RuneLiteModule)1 Before (org.junit.Before)1