Code householding

- Move console initialization for tests into TestHelper
- Remove unused properties in legacy Settings
- Add issue number to TODO comments where applicable
This commit is contained in:
ljacqu
2016-04-14 12:28:19 +02:00
parent 3bb7ff2b85
commit ca0cbe6caf
23 changed files with 82 additions and 101 deletions
+7 -14
View File
@@ -3,11 +3,13 @@ package fr.xephi.authme;
import fr.xephi.authme.command.CommandService;
import fr.xephi.authme.util.BukkitService;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import java.io.File;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Logger;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.verify;
@@ -68,20 +70,6 @@ public final class TestHelper {
runnable.run();
}
/**
* Execute a {@link Runnable} passed to a mock's {@link BukkitService#scheduleSyncDelayedTask(Runnable)} method.
* Note that calling this method expects that there be a runnable sent to the method and will fail
* otherwise.
*
* @param service The mock service
*/
public static void runSyncDelayedTask(BukkitService service) {
ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class);
verify(service).scheduleSyncDelayedTask(captor.capture());
Runnable runnable = captor.getValue();
runnable.run();
}
/**
* Execute a {@link Runnable} passed to a mock's {@link BukkitService#scheduleSyncDelayedTask(Runnable, long)}
* method. Note that calling this method expects that there be a runnable sent to the method and will fail
@@ -96,4 +84,9 @@ public final class TestHelper {
runnable.run();
}
public static Logger setupLogger() {
Logger logger = Mockito.mock(Logger.class);
ConsoleLogger.setLogger(logger);
return logger;
}
}