/*
 * TestPluginDefaultModules.java
 *
 * Copyright (c) 2014. Graham Howden <graham_howden1 at yahoo.co.uk>.
 *
 * This file is part of PluginFramework.
 *
 * PluginFramework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PluginFramework is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PluginFramework.  If not, see <http ://www.gnu.org/licenses/>.
 */

package com.publicuhc.pluginframework.testplugins;

import com.google.inject.Inject;
import com.google.inject.Module;
import com.publicuhc.pluginframework.FrameworkJavaPlugin;
import org.bukkit.Server;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;

import java.io.File;
import java.util.List;

public class TestPluginDefaultModules extends FrameworkJavaPlugin {

    public Plugin injectedPlugin;

    /**
     * This method is intended for unit testing purposes. Its existence may be temporary.
     *
     * @see org.bukkit.plugin.java.JavaPlugin
     */
    public TestPluginDefaultModules(PluginLoader loader, Server server, PluginDescriptionFile pdf, File file1, File file2)
    {
        super(loader, server, pdf, file1, file2);
    }

    @Override
    protected void initialModules(List<Module> modules)
    {
        modules.addAll(getDefaultModules());
    }

    @Inject
    public void setInjectedPlugin(Plugin plugin)
    {
        this.injectedPlugin = plugin;
    }
}

@@ -862,16 +862,57 @@
 ugins;%0A%0A
+import com.google.inject.AbstractModule;%0A
 import c
@@ -961,32 +961,71 @@
 .inject.Module;%0A
+import com.google.inject.util.Modules;%0A
 import com.publi
@@ -1058,32 +1058,164 @@
 workJavaPlugin;%0A
+import com.publicuhc.pluginframework.translate.TranslateModule;%0Aimport com.publicuhc.pluginframework.translate.TranslateReflection;%0A
 import org.bukki
@@ -1383,20 +1383,107 @@
 va.util.
-List
+Iterator;%0Aimport java.util.List;%0A%0Aimport static org.powermock.api.mockito.PowerMockito.mock
 ;%0A%0Apubli
@@ -2014,42 +2014,776 @@
     
-modules.addAll(getDefaultModules()
+List%3CModule%3E defaults = getDefaultModules();%0A        //mock out the reflection class to stop tests not finding the package%0A        Iterator%3CModule%3E iterator = defaults.iterator();%0A        Module toInsert = null;%0A        while(iterator.hasNext()) %7B%0A            Module module = iterator.next();%0A            if(module instanceof TranslateModule) %7B%0A                iterator.remove();%0A                toInsert = Modules.override(module).with(new AbstractModule() %7B%0A                    @Override%0A                    protected void configure() %7B%0A                        bind(TranslateReflection.class).toInstance(mock(TranslateReflection.class));%0A                    %7D%0A                %7D);%0A            %7D%0A        %7D%0A        modules.addAll(defaults);%0A        modules.add(toInsert
 );%0A 

fix the defaultmodules test checking for craftbukkit packages