Logging { public static void setDebugLevel(final int debugLevel) { pluginLogger.setDebugLevel(debugLevel); } private  Logging(); @NotNull static PluginLogger getLogger(); static void setDebugLevel(final int debugLevel); static void log(@NotNull final Level level, @NotNull final String message, @NotNull final Object... args); static void fine(@NotNull final String message, @NotNull final Object...args); static void finer(@NotNull final String message, @NotNull final Object...args); static void finest(@NotNull final String message, @NotNull final Object...args); static void config(@NotNull final String message, @NotNull final Object...args); static void info(@NotNull final String message, @NotNull final Object...args); static void warning(@NotNull final String message, @NotNull final Object...args); static void severe(@NotNull final String message, @NotNull final Object...args);  }
@Test(expected = IllegalArgumentException.class) public void testSetDebugLevelTooHigh() throws Exception { logging.setDebugLevel(4); }
@Test(expected = IllegalArgumentException.class) public void testSetDebugLevelTooLow() throws Exception { logging.setDebugLevel(-1); }
@Test public void testSetDebugLevel() throws Exception { assertTrue(logging.getDebugLog().isClosed()); logging.setDebugLevel(1); assertFalse(logging.getDebugLog().isClosed()); assertEquals(logging.logger, logging.getDebugLog().log); assertEquals(logging.getDebugLog().getDebugFolder(), PluginLogger.getDebugFolder(plugin)); logging.setDebugLevel(0); assertTrue(logging.getDebugLog().isClosed()); logging.setDebugLevel(1); assertFalse(logging.getDebugLog().isClosed()); }
@Test public void testGetDebugLevel() throws Exception { assertEquals(logging.getDebugLevel(), 0); for (int i = 3; i >= 0; i--) { logging.setDebugLevel(i); assertEquals(logging.getDebugLevel(), i); } }
@Test public void testCloseDebugLog() throws Exception { logging.setDebugLevel(3); assertFalse(logging.getDebugLog().isClosed()); logging.shutdown(); assertTrue(logging.getDebugLog().isClosed()); }