Migrate to SLF4J

This commit is contained in:
matt
2019-04-02 18:21:02 -04:00
parent 47e66913e3
commit 29692f3fbe
62 changed files with 1346 additions and 1305 deletions

View File

@ -21,17 +21,21 @@ package com.sk89q.minecraft.util.commands;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.Assert.*;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class CommandContextTest {
private static final Logger log = Logger.getLogger(CommandContextTest.class.getCanonicalName());
private static final Logger log = LoggerFactory.getLogger(CommandContextTest.class);
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
CommandContext firstCommand;
@ -40,7 +44,7 @@ public class CommandContextTest {
try {
firstCommand = new CommandContext(firstCmdString, new HashSet<>(Arrays.asList('o', 'w')));
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Unexpected exception when creating CommandContext");
}
}
@ -79,7 +83,7 @@ public class CommandContextTest {
new CommandContext(cmd);
new CommandContext(cmd2);
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -90,7 +94,7 @@ public class CommandContextTest {
try {
new CommandContext(cmd);
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -101,7 +105,7 @@ public class CommandContextTest {
try {
new CommandContext(cmd);
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -115,7 +119,7 @@ public class CommandContextTest {
CommandContext context2 = new CommandContext("r hello -f world");
assertTrue(context2.hasFlag('f'));
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -131,7 +135,7 @@ public class CommandContextTest {
CommandContext context2 = new CommandContext("pm name \"hello world\" foo bar");
assertEquals("\"hello world\" foo bar", context2.getJoinedStrings(1));
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -143,7 +147,7 @@ public class CommandContextTest {
assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0));
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}
@ -154,7 +158,7 @@ public class CommandContextTest {
CommandContext context = new CommandContext("region flag xmas blocked-cmds \"\"");
assertEquals(context.argsLength(), 3);
} catch (CommandException e) {
log.log(Level.WARNING, "Error", e);
log.warn("Error", e);
fail("Error creating CommandContext");
}
}