Simplify PlayersTableCreator#getActivityString

Remove @SafeVarargs annotation
This commit is contained in:
Fuzzlemann 2017-08-18 12:28:11 +02:00
parent b4e1014d59
commit 486a67a013
9 changed files with 25 additions and 29 deletions

View File

@ -77,7 +77,6 @@ public class Log {
* @param messages All messages to add to the debug log. * @param messages All messages to add to the debug log.
* @return full debug complex so far. * @return full debug complex so far.
*/ */
@SafeVarargs
public static DebugInfo debug(String task, String... messages) { public static DebugInfo debug(String task, String... messages) {
DebugInfo debug = getDebug(task); DebugInfo debug = getDebug(task);
long time = MiscUtils.getTime(); long time = MiscUtils.getTime();

View File

@ -27,11 +27,11 @@ public class Select extends SqlParser {
public Select where(String... conditions) { public Select where(String... conditions) {
append(" WHERE "); append(" WHERE ");
for (int i = 0; i < conditions.length; i++) { for (String condition : conditions) {
if (this.conditions > 0) { if (this.conditions > 0) {
append(" AND "); append(" AND ");
} }
append("(").append(conditions[i]).append(")"); append("(").append(condition).append(")");
this.conditions++; this.conditions++;
} }
return this; return this;

View File

@ -66,9 +66,14 @@ public class PlayersTableCreator {
} }
private static String getActivityString(boolean isBanned, boolean isUnknown, boolean isActive) { private static String getActivityString(boolean isBanned, boolean isUnknown, boolean isActive) {
return isBanned ? "Banned" if (isBanned) {
: (isUnknown ? "Unknown" return "Banned";
: (isActive ? "Active" }
: "Inactive"));
if (isUnknown) {
return "Unknown";
}
return isActive ? "Active" : "Inactive";
} }
} }

View File

@ -18,8 +18,7 @@ public class DumpLog {
* @param header The name of the header * @param header The name of the header
*/ */
public void addHeader(String header) { public void addHeader(String header) {
addLine(""); addLines("", "--- " + header + " ---");
addLine("--- " + header + " ---");
} }
/** /**

View File

@ -74,5 +74,4 @@ public class SettingsTest {
public void testGetPath() { public void testGetPath() {
assertEquals("Settings.WebServer.Enabled", Settings.WEBSERVER_ENABLED.getPath()); assertEquals("Settings.WebServer.Enabled", Settings.WEBSERVER_ENABLED.getPath());
} }
} }

View File

@ -106,15 +106,12 @@ public class DataCacheQueueTest {
public void testGetQueue_cache() { public void testGetQueue_cache() {
List<Integer> calls = new ArrayList<>(); List<Integer> calls = new ArrayList<>();
List<Integer> errors = new ArrayList<>(); List<Integer> errors = new ArrayList<>();
handler.getUserDataForProcessing(new DBCallableProcessor() { handler.getUserDataForProcessing(data -> {
@Override
public void process(UserData data) {
if (data.equals(data1)) { if (data.equals(data1)) {
calls.add(1); calls.add(1);
} else { } else {
errors.add(1); errors.add(1);
} }
}
}, uuid1); }, uuid1);
while (calls.size() < 1) { while (calls.size() < 1) {
if (errors.size() > 0) { if (errors.size() > 0) {
@ -131,15 +128,12 @@ public class DataCacheQueueTest {
public void testGetQueue_dontCache() { public void testGetQueue_dontCache() {
List<Integer> getCalls = new ArrayList<>(); List<Integer> getCalls = new ArrayList<>();
List<Integer> errors = new ArrayList<>(); List<Integer> errors = new ArrayList<>();
handler.getUserDataForProcessing(new DBCallableProcessor() { handler.getUserDataForProcessing(data -> {
@Override
public void process(UserData data) {
if (data.equals(data1)) { if (data.equals(data1)) {
getCalls.add(1); getCalls.add(1);
} else { } else {
errors.add(1); errors.add(1);
} }
}
}, uuid1, false); }, uuid1, false);
while (getCalls.size() < 1) { while (getCalls.size() < 1) {
if (errors.size() > 0) { if (errors.size() > 0) {

View File

@ -10,6 +10,7 @@ import org.junit.Test;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -46,7 +47,7 @@ public class MathUtilsTest {
*/ */
@Test @Test
public void testAverageIntEmpty() { public void testAverageIntEmpty() {
List<Integer> l = new ArrayList<>(); List<Integer> l = Collections.emptyList();
double exp = 0; double exp = 0;
double result = MathUtils.averageInt(l.stream()); double result = MathUtils.averageInt(l.stream());
assertTrue(result + "/" + exp, Double.compare(exp, result) == 0); assertTrue(result + "/" + exp, Double.compare(exp, result) == 0);

View File

@ -46,7 +46,6 @@ public class HastebinTest {
/* Ignored */ /* Ignored */
} }
Log.info(link);
testLink.set(link); testLink.set(link);
}); });

View File

@ -139,7 +139,7 @@ public class TestInit {
@Override @Override
public ITask runTask() { public ITask runTask() {
new Thread(() -> runnable.run()).start(); new Thread(runnable::run).start();
return null; return null;
} }