mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-03 01:00:18 +01:00
Minor cleanups
- Remove forgotten test assertion - Make utils class final - Change RandomString to use char array
This commit is contained in:
parent
922101d755
commit
ee51bb3971
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
/**
|
||||
* Player utilities.
|
||||
*/
|
||||
public class PlayerUtils {
|
||||
public final class PlayerUtils {
|
||||
|
||||
// Utility class
|
||||
private PlayerUtils() {
|
||||
|
@ -8,7 +8,7 @@ import java.util.Random;
|
||||
*/
|
||||
public final class RandomStringUtils {
|
||||
|
||||
private static final String CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
private static final char[] CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
|
||||
private static final Random RANDOM = new SecureRandom();
|
||||
private static final int HEX_MAX_INDEX = 16;
|
||||
private static final int LOWER_ALPHANUMERIC_INDEX = 36;
|
||||
@ -46,7 +46,7 @@ public final class RandomStringUtils {
|
||||
* @return The random string
|
||||
*/
|
||||
public static String generateLowerUpper(int length) {
|
||||
return generate(length, CHARS.length());
|
||||
return generate(length, CHARS.length);
|
||||
}
|
||||
|
||||
private static String generate(int length, int maxIndex) {
|
||||
@ -55,7 +55,7 @@ public final class RandomStringUtils {
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(length);
|
||||
for (int i = 0; i < length; ++i) {
|
||||
sb.append(CHARS.charAt(RANDOM.nextInt(maxIndex)));
|
||||
sb.append(CHARS[RANDOM.nextInt(maxIndex)]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ public class LogFilterHelperTest {
|
||||
.toArray(String[]::new);
|
||||
|
||||
// when / then
|
||||
assertThat(Arrays.asList("test", "toast"), containsInAnyOrder("toast", "test"));
|
||||
assertThat(Arrays.asList(LogFilterHelper.COMMANDS_TO_SKIP), containsInAnyOrder(expectedEntries));
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user