Fix Javadocs and code issues.

This commit is contained in:
sk89q
2014-07-29 11:04:04 -07:00
parent 8834af7538
commit 1dc84d2511
230 changed files with 1646 additions and 1882 deletions

View File

@ -22,12 +22,16 @@ package com.sk89q.minecraft.util.commands;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.Assert.*;
public class CommandContextTest {
private static final Logger log = Logger.getLogger(CommandContextTest.class.getCanonicalName());
private static final String firstCmdString = "herpderp -opw testers \"mani world\" 'another thing' because something";
CommandContext firstCommand;
@ -36,7 +40,7 @@ public class CommandContextTest {
try {
firstCommand = new CommandContext(firstCmdString, new HashSet<Character>(Arrays.asList('o', 'w')));
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Unexpected exception when creating CommandContext");
}
}
@ -75,7 +79,7 @@ public class CommandContextTest {
new CommandContext(cmd);
new CommandContext(cmd2);
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -86,7 +90,7 @@ public class CommandContextTest {
try {
new CommandContext(cmd);
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -97,7 +101,7 @@ public class CommandContextTest {
try {
new CommandContext(cmd);
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -111,7 +115,7 @@ public class CommandContextTest {
CommandContext context2 = new CommandContext("r hello -f world");
assertTrue(context2.hasFlag('f'));
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -127,7 +131,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) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -139,7 +143,7 @@ public class CommandContextTest {
assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0));
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}
@ -150,7 +154,7 @@ public class CommandContextTest {
CommandContext context = new CommandContext("region flag xmas blocked-cmds \"\"");
assertEquals(context.argsLength(), 3);
} catch (CommandException e) {
e.printStackTrace();
log.log(Level.WARNING, "Error", e);
fail("Error creating CommandContext");
}
}

View File

@ -19,18 +19,16 @@
package com.sk89q.worldedit.blocks;
import com.sk89q.worldedit.CuboidClipboard.FlipDirection;
import org.junit.Test;
import java.util.TreeSet;
import org.junit.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.sk89q.worldedit.CuboidClipboard.FlipDirection;
import static org.junit.Assert.*;
/**
* @author TomyLobo
*/
public class BlockDataTest {
@Test
public void testRotateFlip() {
for (int type = 0; type < 256; ++type) {
@ -138,4 +136,5 @@ public class BlockDataTest {
}
}
}
}

View File

@ -19,15 +19,16 @@
package com.sk89q.worldedit.internal.expression;
import static org.junit.Assert.*;
import static java.lang.Math.*;
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
import org.junit.*;
import com.sk89q.worldedit.internal.expression.lexer.LexerException;
import com.sk89q.worldedit.internal.expression.parser.ParserException;
import com.sk89q.worldedit.internal.expression.runtime.EvaluationException;
import com.sk89q.worldedit.internal.expression.runtime.ExpressionEnvironment;
import org.junit.Test;
import static java.lang.Math.atan2;
import static java.lang.Math.sin;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
public class ExpressionTest {
@Test
@ -74,11 +75,11 @@ public class ExpressionTest {
try {
compile("(");
fail("Error expected");
} catch (ParserException e) {}
} catch (ParserException ignored) {}
try {
compile("x(");
fail("Error expected");
} catch (ParserException e) {}
} catch (ParserException ignored) {}
// test overloader errors
try {