Blame eclipse warnings

This commit is contained in:
Gabriele C 2016-03-17 21:16:13 +01:00
parent 1462d3c39e
commit 19070c220b
19 changed files with 34 additions and 28 deletions

View File

@ -31,6 +31,7 @@ public final class MigrationService {
* @param dataSource The data source
* @param authmeSha256 Instance to the AuthMe SHA256 encryption method implementation
*/
@SuppressWarnings("deprecation")
public static void changePlainTextToSha256(NewSetting settings, DataSource dataSource,
SHA256 authmeSha256) {
if (HashAlgorithm.PLAINTEXT == settings.getProperty(SecuritySettings.PASSWORD_HASH)) {
@ -56,6 +57,7 @@ public final class MigrationService {
* @param dataSource The data source
* @return The converted datasource (SQLite), or null if no migration was necessary
*/
@SuppressWarnings("deprecation")
public static DataSource convertFlatfileToSqlite(NewSetting settings, DataSource dataSource) {
if (DataSourceType.FILE == settings.getProperty(DatabaseSettings.BACKEND)) {
ConsoleLogger.showError("FlatFile backend has been detected and is now deprecated; it will be changed "

View File

@ -30,7 +30,7 @@ public class CommandUtilsTest {
@Test
public void shouldPrintEmptyStringForNoArguments() {
// given
List<String> parts = Collections.EMPTY_LIST;
List<String> parts = Collections.emptyList();
// when
String str = CommandUtils.labelsToString(parts);

View File

@ -28,7 +28,7 @@ public class PlayerCommandTest {
PlayerCommandImpl command = new PlayerCommandImpl();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, mock(CommandService.class));
command.executeCommand(sender, Collections.<String> emptyList(), mock(CommandService.class));
// then
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
@ -58,7 +58,7 @@ public class PlayerCommandTest {
PlayerCommandWithAlt command = new PlayerCommandWithAlt();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, mock(CommandService.class));
command.executeCommand(sender, Collections.<String> emptyList(), mock(CommandService.class));
// then
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);

View File

@ -47,7 +47,7 @@ public class AccountsCommandTest {
public void shouldGetAccountsOfCurrentUser() {
// given
given(sender.getName()).willReturn("Tester");
List<String> arguments = Collections.EMPTY_LIST;
List<String> arguments = Collections.emptyList();
given(dataSource.getAuth("tester")).willReturn(authWithIp("123.45.67.89"));
given(dataSource.getAllAuthsByIp("123.45.67.89")).willReturn(Arrays.asList("Toaster", "Pester"));
@ -81,7 +81,7 @@ public class AccountsCommandTest {
// given
List<String> arguments = Collections.singletonList("SomeUser");
given(dataSource.getAuth("someuser")).willReturn(mock(PlayerAuth.class));
given(dataSource.getAllAuthsByIp(anyString())).willReturn(Collections.EMPTY_LIST);
given(dataSource.getAllAuthsByIp(anyString())).willReturn(Collections.<String> emptyList());
// when
command.executeCommand(sender, arguments, service);
@ -115,7 +115,7 @@ public class AccountsCommandTest {
public void shouldReturnIpUnknown() {
// given
List<String> arguments = Collections.singletonList("123.45.67.89");
given(dataSource.getAllAuthsByIp("123.45.67.89")).willReturn(Collections.EMPTY_LIST);
given(dataSource.getAllAuthsByIp("123.45.67.89")).willReturn(Collections.<String> emptyList());
// when
command.executeCommand(sender, arguments, service);

View File

@ -27,7 +27,7 @@ public class AuthMeCommandTest {
CommandService service = mock(CommandService.class);
// when
command.executeCommand(sender, Collections.EMPTY_LIST, service);
command.executeCommand(sender, Collections.<String> emptyList(), service);
// then
ArgumentCaptor<String> messagesCaptor = ArgumentCaptor.forClass(String.class);

View File

@ -36,7 +36,7 @@ public class FirstSpawnCommandTest {
ExecutableCommand command = new FirstSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(player).teleport(firstSpawn);
@ -54,7 +54,7 @@ public class FirstSpawnCommandTest {
ExecutableCommand command = new FirstSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);

View File

@ -103,7 +103,7 @@ public class LastLoginCommandTest {
ExecutableCommand command = new LastLoginCommand();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, service);
command.executeCommand(sender, Collections.<String> emptyList(), service);
// then
verify(dataSource).getAuth(name);

View File

@ -61,7 +61,7 @@ public class PurgeLastPositionCommandTest {
ExecutableCommand command = new PurgeLastPositionCommand();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, service);
command.executeCommand(sender, Collections.<String> emptyList(), service);
// then
verify(dataSource).getAuth(player);

View File

@ -37,7 +37,7 @@ public class ReloadCommandTest {
ExecutableCommand command = new ReloadCommand();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, service);
command.executeCommand(sender, Collections.<String> emptyList(), service);
// then
verify(authMe).reload();
@ -55,7 +55,7 @@ public class ReloadCommandTest {
ExecutableCommand command = new ReloadCommand();
// when
command.executeCommand(sender, Collections.EMPTY_LIST, service);
command.executeCommand(sender, Collections.<String> emptyList(), service);
// then
verify(authMe).reload();

View File

@ -35,7 +35,7 @@ public class SetFirstSpawnCommandTest {
ExecutableCommand command = new SetFirstSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(spawnLoader).setFirstSpawn(location);
@ -57,7 +57,7 @@ public class SetFirstSpawnCommandTest {
ExecutableCommand command = new SetFirstSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(spawnLoader).setFirstSpawn(location);

View File

@ -35,7 +35,7 @@ public class SetSpawnCommandTest {
ExecutableCommand command = new SetSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(spawnLoader).setSpawn(location);
@ -57,7 +57,7 @@ public class SetSpawnCommandTest {
ExecutableCommand command = new SetSpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(spawnLoader).setSpawn(location);

View File

@ -35,7 +35,7 @@ public class SpawnCommandTest {
ExecutableCommand command = new SpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(player).teleport(spawn);
@ -53,7 +53,7 @@ public class SpawnCommandTest {
ExecutableCommand command = new SpawnCommand();
// when
command.executeCommand(player, Collections.EMPTY_LIST, service);
command.executeCommand(player, Collections.<String> emptyList(), service);
// then
verify(player).sendMessage(argThat(containsString("Spawn has failed")));

View File

@ -44,7 +44,7 @@ public class ChangePasswordCommandTest {
when(commandService.getProperty(SecuritySettings.MAX_PASSWORD_LENGTH)).thenReturn(50);
// Only allow passwords with alphanumerical characters for the test
when(commandService.getProperty(RestrictionSettings.ALLOWED_PASSWORD_REGEX)).thenReturn("[a-zA-Z0-9]+");
when(commandService.getProperty(SecuritySettings.UNSAFE_PASSWORDS)).thenReturn(Collections.EMPTY_LIST);
when(commandService.getProperty(SecuritySettings.UNSAFE_PASSWORDS)).thenReturn(Collections.<String> emptyList());
}
@Test

View File

@ -253,7 +253,7 @@ public class HelpProviderTest {
public void shouldHandleUnboundFoundCommandResult() {
// given
FoundCommandResult result = new FoundCommandResult(null, Arrays.asList("authme", "test"),
Collections.EMPTY_LIST, 0.0, FoundResultStatus.UNKNOWN_LABEL);
Collections.<String> emptyList(), 0.0, FoundResultStatus.UNKNOWN_LABEL);
// when
List<String> lines = helpProvider.printHelp(sender, result, ALL_OPTIONS);
@ -317,7 +317,7 @@ public class HelpProviderTest {
* @return The generated FoundCommandResult object
*/
private static FoundCommandResult newFoundResult(CommandDescription command, List<String> labels) {
return new FoundCommandResult(command, labels, Collections.EMPTY_LIST, 0.0, FoundResultStatus.SUCCESS);
return new FoundCommandResult(command, labels, Collections.<String> emptyList(), 0.0, FoundResultStatus.SUCCESS);
}
private static String removeColors(String str) {

View File

@ -97,6 +97,7 @@ public abstract class AbstractResourceClosingTest {
}
/** Initialize the settings mock and makes it return the default of any given property by default. */
@SuppressWarnings({ "unchecked", "rawtypes" })
@BeforeClass
public static void initializeSettings() throws IOException, ClassNotFoundException {
settings = mock(NewSetting.class);

View File

@ -38,6 +38,7 @@ public class MySqlIntegrationTest extends AbstractDataSourceIntegrationTest {
/**
* Set up the settings mock to return specific values for database settings and load {@link #sqlInitialize}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@BeforeClass
public static void initializeSettings() throws IOException, ClassNotFoundException {
// Check that we have an H2 driver

View File

@ -37,6 +37,7 @@ public class SQLiteIntegrationTest extends AbstractDataSourceIntegrationTest {
/**
* Set up the settings mock to return specific values for database settings and load {@link #sqlInitialize}.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@BeforeClass
public static void initializeSettings() throws IOException, ClassNotFoundException {
// Check that we have an implementation for SQLite

View File

@ -112,6 +112,7 @@ public class SettingsClassConsistencyTest {
return Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers);
}
@SuppressWarnings("unchecked")
private static Class<? extends SettingsClass> getSettingsClassFromFile(File file) {
String fileName = file.getPath();
String className = fileName

View File

@ -110,8 +110,8 @@ public class UtilsTest {
public void shouldAcceptEmailWithEmptyLists() {
// given
NewSetting settings = mock(NewSetting.class);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.<String> emptyList());
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.<String> emptyList());
// when
boolean result = Utils.isEmailCorrect("test@example.org", settings);
@ -126,7 +126,7 @@ public class UtilsTest {
NewSetting settings = mock(NewSetting.class);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST))
.willReturn(Arrays.asList("domain.tld", "example.com"));
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.<String> emptyList());
// when
boolean result = Utils.isEmailCorrect("TesT@Example.com", settings);
@ -141,7 +141,7 @@ public class UtilsTest {
NewSetting settings = mock(NewSetting.class);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST))
.willReturn(Arrays.asList("domain.tld", "example.com"));
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST)).willReturn(Collections.<String> emptyList());
// when
boolean result = Utils.isEmailCorrect("email@other-domain.abc", settings);
@ -154,7 +154,7 @@ public class UtilsTest {
public void shouldAcceptEmailNotInBlacklist() {
// given
NewSetting settings = mock(NewSetting.class);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.<String> emptyList());
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST))
.willReturn(Arrays.asList("Example.org", "a-test-name.tld"));
@ -169,7 +169,7 @@ public class UtilsTest {
public void shouldRejectEmailInBlacklist() {
// given
NewSetting settings = mock(NewSetting.class);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.EMPTY_LIST);
given(settings.getProperty(EmailSettings.DOMAIN_WHITELIST)).willReturn(Collections.<String> emptyList());
given(settings.getProperty(EmailSettings.DOMAIN_BLACKLIST))
.willReturn(Arrays.asList("Example.org", "a-test-name.tld"));