Search in sources :

Example 1 with BukkitWorker

use of org.bukkit.scheduler.BukkitWorker in project AuthMeReloaded by AuthMe.

the class TaskCloserTest method mockBukkitWorker.

private BukkitWorker mockBukkitWorker(Plugin owner, int taskId, boolean isQueued) {
    BukkitWorker worker = mock(BukkitWorker.class);
    given(worker.getOwner()).willReturn(owner);
    given(worker.getTaskId()).willReturn(taskId);
    given(bukkitScheduler.isQueued(taskId)).willReturn(isQueued);
    return worker;
}
Also used : BukkitWorker(org.bukkit.scheduler.BukkitWorker)

Example 2 with BukkitWorker

use of org.bukkit.scheduler.BukkitWorker in project AuthMeReloaded by AuthMe.

the class TaskCloserTest method mockActiveWorkers.

private void mockActiveWorkers() {
    Plugin otherOwner = mock(Plugin.class);
    List<BukkitWorker> tasks = Arrays.asList(mockBukkitWorker(authMe, ACTIVE_WORKERS_ID[0], false), mockBukkitWorker(otherOwner, 3, false), mockBukkitWorker(authMe, ACTIVE_WORKERS_ID[1], false), mockBukkitWorker(authMe, 7, true), mockBukkitWorker(otherOwner, 11, true));
    given(bukkitScheduler.getActiveWorkers()).willReturn(tasks);
}
Also used : BukkitWorker(org.bukkit.scheduler.BukkitWorker) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Aggregations

BukkitWorker (org.bukkit.scheduler.BukkitWorker)2 Plugin (org.bukkit.plugin.Plugin)1 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)1