In the constructor(s) for org.bukkit.plugin.java.JavaPlugin, the class loader is enforced and required to be an instance of org.bukkit.plugin.java.PluginClassLoader. If this condition is not met, an IllegalStateException will be thrown with the following stack trace: JavaPlugin requires org.bukkit.plugin.java.PluginClassLoader java.lang.IllegalStateException: JavaPlugin requires org.bukkit.plugin.java.PluginClassLoader at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:51) at com.testplugin.TestPlugin.<init>(TestPlugin.java:8) ... I understand that this is intended design to ensure that the plugin has been loaded from the .jar, but a side effect of doing this in the constructor is that it makes it far more difficult to fully unit test one's plugin using JUnit + Mockito. - You can't test the onEnable() or onDisable() methods because you can't create an instance of your plugin to call them on due to the classloader issue - You can't mock the instance of your plugin because that is the thing you are trying to test - You can't mock the classLoader to be an instance of PluginClassLoader as that class is not accessible - You can't mock the constructor in the JavaPlugin class as constructor mocking is not well supported by Mockito & the JavaPlugin class is abstract The only way I have been able to get this working is to incorporate PowerMock to directly create an instance of either the JavaPlugin class or my own plugin class in a way that bypasses the constructors entirely, which I don't consider a great solution since generally I try to not rely on PowerMock's bytecode manipulation voodoo. Is there a recommended way to test the main plugin class that I'm perhaps missing?