Write tests for AsyncUnregister and TaskCloser

This commit is contained in:
ljacqu
2016-08-27 21:26:15 +02:00
parent afd4498184
commit f59a584622
4 changed files with 336 additions and 1 deletions
@@ -1,5 +1,6 @@
package fr.xephi.authme.initialization;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.datasource.DataSource;
import org.bukkit.scheduler.BukkitScheduler;
@@ -50,7 +51,7 @@ public class TaskCloser implements Runnable {
}
try {
Thread.sleep(1000);
sleep();
} catch (InterruptedException ignored) {
Thread.currentThread().interrupt();
break;
@@ -73,6 +74,12 @@ public class TaskCloser implements Runnable {
}
}
/** Makes the current thread sleep for one second. */
@VisibleForTesting
void sleep() throws InterruptedException {
Thread.sleep(1000);
}
private List<Integer> getPendingTasks() {
List<Integer> pendingTasks = new ArrayList<>();
//returns only the async tasks