mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-20 15:47:38 +01:00
Minor: pass null as migration service in tests if no migration should occur
This commit is contained in:
parent
3ce6d06f1c
commit
5b51ecb0dd
@ -34,7 +34,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static fr.xephi.authme.settings.TestSettingsMigrationServices.alwaysFulfilled;
|
||||
import static fr.xephi.authme.settings.properties.AuthMeSettingsRetriever.buildConfigurationData;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
@ -90,7 +89,7 @@ public class AuthMeInitializationTest {
|
||||
public void shouldInitializeAllServices() {
|
||||
// given
|
||||
Settings settings =
|
||||
new Settings(dataFolder, mock(PropertyResource.class), alwaysFulfilled(), buildConfigurationData());
|
||||
new Settings(dataFolder, mock(PropertyResource.class), null, buildConfigurationData());
|
||||
|
||||
Injector injector = new InjectorBuilder().addDefaultHandlers("fr.xephi.authme").create();
|
||||
injector.provide(DataFolder.class, dataFolder);
|
||||
|
@ -121,8 +121,7 @@ public class SettingsIntegrationTest {
|
||||
// given
|
||||
File configFile = temporaryFolder.newFile();
|
||||
PropertyResource resource = new YamlFileResource(configFile);
|
||||
Settings settings = new Settings(testPluginFolder, resource,
|
||||
TestSettingsMigrationServices.alwaysFulfilled(), CONFIG_DATA);
|
||||
Settings settings = new Settings(testPluginFolder, resource, null, CONFIG_DATA);
|
||||
|
||||
// when
|
||||
assertThat(settings.getProperty(TestConfiguration.RATIO_ORDER), equalTo(TestEnum.SECOND)); // default value
|
||||
|
@ -55,8 +55,7 @@ public class SettingsTest {
|
||||
|
||||
PropertyResource resource = mock(PropertyResource.class);
|
||||
given(resource.getBoolean(RegistrationSettings.USE_WELCOME_MESSAGE.getPath())).willReturn(true);
|
||||
Settings settings = new Settings(testPluginFolder, resource,
|
||||
TestSettingsMigrationServices.alwaysFulfilled(), CONFIG_DATA);
|
||||
Settings settings = new Settings(testPluginFolder, resource, null, CONFIG_DATA);
|
||||
|
||||
// when
|
||||
String[] result = settings.getWelcomeMessage();
|
||||
@ -75,8 +74,7 @@ public class SettingsTest {
|
||||
Files.write(emailFile.toPath(), emailMessage.getBytes());
|
||||
|
||||
PropertyResource resource = mock(PropertyResource.class);
|
||||
Settings settings = new Settings(testPluginFolder, resource,
|
||||
TestSettingsMigrationServices.alwaysFulfilled(), CONFIG_DATA);
|
||||
Settings settings = new Settings(testPluginFolder, resource, null, CONFIG_DATA);
|
||||
|
||||
// when
|
||||
String result = settings.getPasswordEmailMessage();
|
||||
|
@ -1,21 +0,0 @@
|
||||
package fr.xephi.authme.settings;
|
||||
|
||||
import com.github.authme.configme.migration.MigrationService;
|
||||
|
||||
/**
|
||||
* Provides {@link MigrationService} implementations for testing.
|
||||
*/
|
||||
public final class TestSettingsMigrationServices {
|
||||
|
||||
private TestSettingsMigrationServices() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a settings migration service which always answers that all data is up-to-date.
|
||||
*
|
||||
* @return test settings migration service
|
||||
*/
|
||||
public static MigrationService alwaysFulfilled() {
|
||||
return (propertyResource, knownProperties) -> false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user