mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Fix test class names
This commit is contained in:
+52
-23
@@ -1,17 +1,65 @@
|
||||
package org.apollo.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Contains tests for {@link BufferUtil}.
|
||||
* Contains unit tests for {@link BufferUtil}s.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public class TestBufferUtil {
|
||||
public final class BufferUtilTests {
|
||||
|
||||
/**
|
||||
* Test the {@link BufferUtil#readString(ByteBuf)} method.
|
||||
*/
|
||||
@Test
|
||||
public void readByteBufString() {
|
||||
ByteBuf buf = Unpooled.buffer(6);
|
||||
buf.writeBytes(new byte[]{ 'H', 'e', 'l', 'l', 'o', 10 });
|
||||
String str = BufferUtil.readString(buf);
|
||||
assertEquals("Hello", str);
|
||||
|
||||
buf = Unpooled.buffer(5);
|
||||
buf.writeBytes(new byte[]{ 'W', 'o', 'r', 'l', 'd' });
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals("World", str);
|
||||
|
||||
buf = Unpooled.buffer(3);
|
||||
buf.writeByte('!');
|
||||
buf.writeByte(10);
|
||||
buf.writeByte('.');
|
||||
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals("!", str);
|
||||
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals(".", str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the {@link BufferUtil#readString(ByteBuffer)} method.
|
||||
*/
|
||||
@Test
|
||||
public void readByteBufferString() {
|
||||
ByteBuffer buf = ByteBuffer.allocate(8);
|
||||
buf.put((byte) 'h');
|
||||
buf.put((byte) 'e');
|
||||
buf.put((byte) 'l');
|
||||
buf.put((byte) 'l');
|
||||
buf.put((byte) 'o');
|
||||
buf.put((byte) BufferUtil.STRING_TERMINATOR);
|
||||
buf.put((byte) 66);
|
||||
buf.put((byte) 6);
|
||||
buf.flip();
|
||||
|
||||
assertEquals("hello", BufferUtil.readString(buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the {@link BufferUtil#readUnsignedMedium} method.
|
||||
@@ -27,23 +75,4 @@ public class TestBufferUtil {
|
||||
assertEquals(8072515, BufferUtil.readUnsignedMedium(buf));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the {@link BufferUtil#readString(ByteBuffer)} method.
|
||||
*/
|
||||
@Test
|
||||
public void testReadString() {
|
||||
ByteBuffer buf = ByteBuffer.allocate(8);
|
||||
buf.put((byte) 'h');
|
||||
buf.put((byte) 'e');
|
||||
buf.put((byte) 'l');
|
||||
buf.put((byte) 'l');
|
||||
buf.put((byte) 'o');
|
||||
buf.put((byte) BufferUtil.STRING_TERMINATOR);
|
||||
buf.put((byte) 66);
|
||||
buf.put((byte) 6);
|
||||
buf.flip();
|
||||
|
||||
assertEquals("hello", BufferUtil.readString(buf));
|
||||
}
|
||||
|
||||
}
|
||||
+6
-6
@@ -1,17 +1,17 @@
|
||||
package org.apollo.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Contains tests for {@link CompressionUtil}.
|
||||
* Contains unit tests for {@link CompressionUtil}s.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public class TestCompressionUtil {
|
||||
public class CompressionUtilTests {
|
||||
|
||||
/**
|
||||
* Tests the {@link CompressionUtil#bzip2(byte[])} and {@link CompressionUtil#debzip2} methods.
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
package org.apollo.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Contains tests for {@link LanguageUtil}.
|
||||
* Contains unit tests for {@link LanguageUtil}s.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public class TestLanguageUtil {
|
||||
public class LanguageUtilTests {
|
||||
|
||||
/**
|
||||
* Tests the {@link LanguageUtil#getIndefiniteArticle} method.
|
||||
@@ -1,43 +0,0 @@
|
||||
package org.apollo.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Contains tests for {@link ByteBuf} methods in {@link BufferUtil}.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class TestByteBufUtil {
|
||||
|
||||
/**
|
||||
* Test the {@link BufferUtil#readString(ByteBuf)} method.
|
||||
*/
|
||||
@Test
|
||||
public void testReadString() {
|
||||
ByteBuf buf = Unpooled.buffer(6);
|
||||
buf.writeBytes(new byte[] { 'H', 'e', 'l', 'l', 'o', 10 });
|
||||
String str = BufferUtil.readString(buf);
|
||||
assertEquals("Hello", str);
|
||||
|
||||
buf = Unpooled.buffer(5);
|
||||
buf.writeBytes(new byte[] { 'W', 'o', 'r', 'l', 'd' });
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals("World", str);
|
||||
|
||||
buf = Unpooled.buffer(3);
|
||||
buf.writeByte('!');
|
||||
buf.writeByte(10);
|
||||
buf.writeByte('.');
|
||||
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals("!", str);
|
||||
|
||||
str = BufferUtil.readString(buf);
|
||||
assertEquals(".", str);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
package org.apollo.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* A test for the {@link TextUtil} class.
|
||||
* Contains unit tests for {@link TextUtil}s.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public class TestTextUtil {
|
||||
public class TextUtilTests {
|
||||
|
||||
/**
|
||||
* Tests the {@link TextUtil#capitalize} method.
|
||||
+21
-21
@@ -1,9 +1,7 @@
|
||||
package org.apollo.util.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -12,15 +10,17 @@ import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xml.sax.SAXException;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* A test for the {@link XmlParser} class.
|
||||
* Contains unit tests for {@link XmlParser}s.
|
||||
*
|
||||
* @author Graham
|
||||
*/
|
||||
public final class TestXmlParser {
|
||||
public final class XmlParserTests {
|
||||
|
||||
/**
|
||||
* A test for the {@link XmlParser#parse} method.
|
||||
@@ -34,9 +34,9 @@ public final class TestXmlParser {
|
||||
InputStream input = new ByteArrayInputStream("<root a='1' b='2' c='3'><z><y><x></x></y></z></root>".getBytes());
|
||||
XmlNode root = parser.parse(input);
|
||||
|
||||
assertEquals(root.getName(), "root");
|
||||
assertEquals(root.getAttributeCount(), 3);
|
||||
assertEquals(root.getChildCount(), 1);
|
||||
assertEquals("root", root.getName());
|
||||
assertEquals(3, root.getAttributeCount());
|
||||
assertEquals(1, root.getChildCount());
|
||||
assertFalse(root.hasValue());
|
||||
|
||||
Set<String> names = root.getAttributeNames();
|
||||
@@ -81,24 +81,24 @@ public final class TestXmlParser {
|
||||
Reader reader = new StringReader("<alphabet><a>1</a><b>2</b><c>3</c></alphabet>");
|
||||
XmlNode root = parser.parse(reader);
|
||||
|
||||
assertEquals(root.getName(), "alphabet");
|
||||
assertEquals(root.getAttributeCount(), 0);
|
||||
assertEquals(root.getChildCount(), 3);
|
||||
assertEquals("alphabet", root.getName());
|
||||
assertEquals(0, root.getAttributeCount());
|
||||
assertEquals(3, root.getChildCount());
|
||||
assertFalse(root.hasValue());
|
||||
|
||||
XmlNode[] children = root.getChildren().toArray(new XmlNode[3]);
|
||||
|
||||
assertEquals(children[0].getName(), "a");
|
||||
assertEquals(children[1].getName(), "b");
|
||||
assertEquals(children[2].getName(), "c");
|
||||
assertEquals("a", children[0].getName());
|
||||
assertEquals("b", children[1].getName());
|
||||
assertEquals("c", children[2].getName());
|
||||
|
||||
assertEquals(children[0].getValue(), "1");
|
||||
assertEquals(children[1].getValue(), "2");
|
||||
assertEquals(children[2].getValue(), "3");
|
||||
assertEquals("1", children[0].getValue());
|
||||
assertEquals("2", children[1].getValue());
|
||||
assertEquals("3", children[2].getValue());
|
||||
|
||||
for (int index = 0; index < 3; index++) {
|
||||
assertTrue(children[index].hasValue());
|
||||
assertEquals(children[index].getAttributeCount(), 0);
|
||||
assertEquals(0, children[index].getAttributeCount());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user