@Before public void setUp() throws Exception { creator = new TestInstanceCreator(); assertTrue(creator.setUp()); mockServer = creator.getServer(); mockCommandSender = creator.getCommandSender(); // Pull a core instance from the server. Plugin plugin = mockServer.getPluginManager().getPlugin("SpamHammer"); myPlugin = (SpamHammerPlugin) plugin; // Make sure plugin is not null assertNotNull(plugin); // Make sure plugin is enabled assertTrue(plugin.isEnabled()); Field field = SpamHammerPlugin.class.getDeclaredField("listener"); field.setAccessible(true); listener = (PluginListener) field.get(myPlugin); }
@After public void tearDown() throws Exception { creator.tearDown(); }