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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user