- Change AuthMeMockUtils (reflection-based test setup) to ReflectionUtils: service providing reflection functionalities for particular tests where it is appropriate; - Initialize the data folder (required as soon as the Settings class is loaded) immediately in WrapperMock. Some tests did not set it up that required it and it goes unnoticed if the test is not run individually. This will hopefully fix the tests from failing in the Jenkins build.
36 lines
783 B
Java
36 lines
783 B
Java
package fr.xephi.authme;
|
|
|
|
import fr.xephi.authme.settings.Settings;
|
|
import fr.xephi.authme.util.WrapperMock;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
import static org.mockito.Matchers.any;
|
|
import static org.mockito.Mockito.never;
|
|
import static org.mockito.Mockito.verify;
|
|
|
|
/**
|
|
* Test for {@link AntiBot}.
|
|
*/
|
|
public class AntiBotTest {
|
|
|
|
private WrapperMock wrapper;
|
|
|
|
@Before
|
|
public void setUpMocks() {
|
|
wrapper = WrapperMock.createInstance();
|
|
}
|
|
|
|
@Test
|
|
public void shouldNotEnableAntiBot() {
|
|
// given
|
|
Settings.enableAntiBot = false;
|
|
|
|
// when
|
|
AntiBot.setupAntiBotService();
|
|
|
|
// then
|
|
verify(wrapper.getScheduler(), never()).scheduleSyncDelayedTask(any(AuthMe.class), any(Runnable.class));
|
|
}
|
|
}
|