Made test class names consistent with other tests

Make test classes final

Ensure all test method names are consistent
This commit is contained in:
atomicint
2016-02-08 12:49:44 -05:00
parent e4d01e6e54
commit d2b54bde4d
9 changed files with 64 additions and 67 deletions
@@ -15,13 +15,13 @@ import static org.powermock.api.mockito.PowerMockito.*;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Player.class}) @PrepareForTest({Player.class})
public class ChatMessageHandlerTest { public final class ChatMessageHandlerTests {
private final World world = new World(); private final World world = new World();
private final ChatMessageHandler chatMessageHandler = new ChatMessageHandler(world); private final ChatMessageHandler chatMessageHandler = new ChatMessageHandler(world);
@Test @Test
public void testTerminatedIfMuted() throws Exception { public void terminateIfMuted() throws Exception {
Player player = PowerMockito.mock(Player.class); Player player = PowerMockito.mock(Player.class);
when(player.isMuted()).thenReturn(true); when(player.isMuted()).thenReturn(true);
@@ -19,11 +19,11 @@ import static org.powermock.api.mockito.PowerMockito.*;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Player.class, ItemDefinition.class}) @PrepareForTest({Player.class, ItemDefinition.class})
public class ItemOnItemVerificationHandlerTest { public final class ItemOnItemVerificationHandlerTests {
private World world = new World(); private final World world = new World();
private ItemOnItemVerificationHandler itemOnItemVerificationHandler = new ItemOnItemVerificationHandler(world); private final ItemOnItemVerificationHandler itemOnItemVerificationHandler = new ItemOnItemVerificationHandler(world);
@Before @Before
public void setupTestItemDefinitions() { public void setupTestItemDefinitions() {
@@ -32,7 +32,7 @@ public class ItemOnItemVerificationHandlerTest {
} }
@Test @Test
public void testTerminateWithNoTargetItem() throws Exception { public void terminateWithNoTargetItem() throws Exception {
Player player = mock(Player.class); Player player = mock(Player.class);
Inventory inventory = new Inventory(28); Inventory inventory = new Inventory(28);
inventory.set(1, new Item(4151, 1)); inventory.set(1, new Item(4151, 1));
@@ -30,7 +30,7 @@ import static org.powermock.api.mockito.PowerMockito.*;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Player.class, World.class, Region.class, RegionRepository.class, ObjectDefinition.class, @PrepareForTest({Player.class, World.class, Region.class, RegionRepository.class, ObjectDefinition.class,
ItemDefinition.class}) ItemDefinition.class})
public class ItemOnObjectVerificationHandlerTest { public final class ItemOnObjectVerificationHandlerTests {
@Before @Before
public void setupTestItemDefinitions() { public void setupTestItemDefinitions() {
@@ -43,7 +43,7 @@ public class ItemOnObjectVerificationHandlerTest {
@Test @Test
public void testTerminateIfInvalidItem() throws Exception { public void terminateIfInvalidItem() throws Exception {
Position playerPosition = new Position(3200, 3200); Position playerPosition = new Position(3200, 3200);
Position objectPosition = new Position(3200, 3216); Position objectPosition = new Position(3200, 3216);
@@ -73,7 +73,7 @@ public class ItemOnObjectVerificationHandlerTest {
} }
@Test @Test
public void testTerminateIfInvalidSlot() throws Exception { public void terminateIfInvalidSlot() throws Exception {
Position playerPosition = new Position(3200, 3200); Position playerPosition = new Position(3200, 3200);
Position objectPosition = new Position(3200, 3200); Position objectPosition = new Position(3200, 3200);
@@ -103,7 +103,7 @@ public class ItemOnObjectVerificationHandlerTest {
} }
@Test @Test
public void testTerminateIfObjectOutOfRange() throws Exception { public void terminateIfObjectOutOfRange() throws Exception {
Position playerPosition = new Position(3200, 3200); Position playerPosition = new Position(3200, 3200);
Position objectPosition = new Position(3200, 3200); Position objectPosition = new Position(3200, 3200);
@@ -28,7 +28,7 @@ import static org.powermock.api.mockito.PowerMockito.when;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({World.class, Player.class, ObjectDefinition.class, RegionRepository.class, Region.class}) @PrepareForTest({World.class, Player.class, ObjectDefinition.class, RegionRepository.class, Region.class})
public class ObjectActionVerificationHandlerTest { public final class ObjectActionVerificationHandlerTests {
@Before @Before
public void setupTestObjectDefinitions() { public void setupTestObjectDefinitions() {
@@ -37,7 +37,7 @@ public class ObjectActionVerificationHandlerTest {
} }
@Test @Test
public void testTerminateIfOutOfRange() throws Exception { public void terminateIfOutOfRange() throws Exception {
Position playerPosition = new Position(3200, 3200); Position playerPosition = new Position(3200, 3200);
Position objectPosition = new Position(3200, 3216); Position objectPosition = new Position(3200, 3216);
@@ -64,8 +64,7 @@ public class ObjectActionVerificationHandlerTest {
} }
@Test @Test
public void terminateIfNoObject() throws Exception {
public void testTerminateIfNoObject() throws Exception {
Position playerPosition = new Position(3200, 3200); Position playerPosition = new Position(3200, 3200);
Position objectPosition = new Position(3200, 3201); Position objectPosition = new Position(3200, 3201);
@@ -0,0 +1,36 @@
package org.apollo.game.model;
import org.junit.Assert;
import org.junit.Test;
/**
* Tests the {@link Position} class.
*/
public final class PositionTests {
/**
* Tests the {@link Position#getHeight()} method.
*/
@Test
public void getHeight() {
Position position = new Position(3222, 3222, 3);
Assert.assertEquals(3, position.getHeight());
}
/**
* Tests the creation of an invalid {@link Position}.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void createNegativePosition() {
new Position(3222, 3222, -1);
}
/**
* Tests the creation of an invalid {@link Position}.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void createOutOfBoundsPosition() {
new Position(3222, 3222, 4);
}
}
@@ -1,38 +0,0 @@
package org.apollo.game.model;
import org.junit.Assert;
import org.junit.Test;
/**
* Tests the {@link Position} class.
*
* @author Ryley
*/
public final class TestPosition {
/**
* Tests the {@link Position#getHeight()} method.
*/
@Test
public void testGetHeight() {
Position position = new Position(3222, 3222, 3);
Assert.assertEquals(3, position.getHeight());
}
/**
* Tests the creation of an invalid {@link Position}.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void testCreateNegativePosition() {
new Position(3222, 3222, -1);
}
/**
* Tests the creation of an invalid {@link Position}.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void testCreateOutOfBoundsPosition() {
new Position(3222, 3222, 4);
}
}
@@ -21,7 +21,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest(Player.class) @PrepareForTest(Player.class)
public final class MobRepositoryTest { public final class MobRepositoryTests {
/** /**
* The capacity of the MobRepository. * The capacity of the MobRepository.
@@ -32,7 +32,7 @@ public final class MobRepositoryTest {
* Tests {@link MobRepository#capacity()}. * Tests {@link MobRepository#capacity()}.
*/ */
@Test @Test
public void testCapacity() { public void capacity() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
assertEquals(CAPACITY, players.capacity()); assertEquals(CAPACITY, players.capacity());
@@ -42,7 +42,7 @@ public final class MobRepositoryTest {
* Tests {@link MobRepository#add(Mob)}. * Tests {@link MobRepository#add(Mob)}.
*/ */
@Test @Test
public void testAdd() { public void add() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player player = mock(Player.class); Player player = mock(Player.class);
@@ -58,7 +58,7 @@ public final class MobRepositoryTest {
* Tests {@link MobRepository#remove(Mob)}. * Tests {@link MobRepository#remove(Mob)}.
*/ */
@Test @Test
public void testRemove() { public void remove() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player player = mock(Player.class); Player player = mock(Player.class);
@@ -77,7 +77,7 @@ public final class MobRepositoryTest {
* Tests failing of {@link MobRepository#remove(Mob)} * Tests failing of {@link MobRepository#remove(Mob)}
*/ */
@Test(expected = NullPointerException.class) @Test(expected = NullPointerException.class)
public void testRemoveNull() { public void removeNull() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
players.remove(null); players.remove(null);
} }
@@ -86,7 +86,7 @@ public final class MobRepositoryTest {
* Ensures that a MobRepository maintains a fixed capacity. * Ensures that a MobRepository maintains a fixed capacity.
*/ */
@Test @Test
public void testCapacityExceeded() { public void capacityExceeded() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
for (int index = 0; index < CAPACITY; index++) { for (int index = 0; index < CAPACITY; index++) {
@@ -107,7 +107,7 @@ public final class MobRepositoryTest {
* Tests {@link Iterator#hasNext()} for a MobRepository. * Tests {@link Iterator#hasNext()} for a MobRepository.
*/ */
@Test @Test
public void testIteratorHasNext() { public void iteratorHasNext() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player player = mock(Player.class); Player player = mock(Player.class);
@@ -123,7 +123,7 @@ public final class MobRepositoryTest {
* Tests {@link Iterator#next()} for a MobRepository. * Tests {@link Iterator#next()} for a MobRepository.
*/ */
@Test @Test
public void testIteratorNext() { public void iteratorNext() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player first = mock(Player.class); Player first = mock(Player.class);
@@ -148,7 +148,7 @@ public final class MobRepositoryTest {
* Tests {@link Iterator#remove()} for a MobRepository. * Tests {@link Iterator#remove()} for a MobRepository.
*/ */
@Test @Test
public void testIteratorRemove() { public void iteratorRemove() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player first = mock(Player.class); Player first = mock(Player.class);
@@ -175,7 +175,7 @@ public final class MobRepositoryTest {
* {@link NoSuchElementException} if the iterator contains no more elements. * {@link NoSuchElementException} if the iterator contains no more elements.
*/ */
@Test(expected = NoSuchElementException.class) @Test(expected = NoSuchElementException.class)
public void testIteratorNextOverflow() { public void iteratorNextOverflow() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player first = mock(Player.class); Player first = mock(Player.class);
@@ -201,7 +201,7 @@ public final class MobRepositoryTest {
* next(). * next().
*/ */
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void testIteratorRemoveIllegalState() { public void iteratorRemoveIllegalState() {
MobRepository<Player> players = new MobRepository<>(CAPACITY); MobRepository<Player> players = new MobRepository<>(CAPACITY);
Player player = mock(Player.class); Player player = mock(Player.class);
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertEquals;
* *
* @author Graham * @author Graham
*/ */
public class TestGamePacketEncoder { public class GamePacketEncoderTests {
/** /**
* Tests the {@link GamePacketEncoder#encode} method. * Tests the {@link GamePacketEncoder#encode} method.
@@ -21,7 +21,7 @@ public class TestGamePacketEncoder {
* @throws Exception If an error occurs. * @throws Exception If an error occurs.
*/ */
@Test @Test
public void testEncode() throws Exception { public void encode() throws Exception {
// generates 243, 141, 34, -223, 121... // generates 243, 141, 34, -223, 121...
IsaacRandom random = new IsaacRandom(new int[] { 0, 0, 0, 0 }); IsaacRandom random = new IsaacRandom(new int[] { 0, 0, 0, 0 });
GamePacketEncoder encoder = new GamePacketEncoder(random); GamePacketEncoder encoder = new GamePacketEncoder(random);
@@ -29,7 +29,7 @@ public final class XmlParserTests {
* @throws IOException If an I/O error occurs. * @throws IOException If an I/O error occurs.
*/ */
@Test @Test
public void testParseInputStream() throws SAXException, IOException { public void parseInputStream() throws SAXException, IOException {
XmlParser parser = new XmlParser(); XmlParser parser = new XmlParser();
InputStream input = new ByteArrayInputStream("<root a='1' b='2' c='3'><z><y><x></x></y></z></root>".getBytes()); InputStream input = new ByteArrayInputStream("<root a='1' b='2' c='3'><z><y><x></x></y></z></root>".getBytes());
XmlNode root = parser.parse(input); XmlNode root = parser.parse(input);
@@ -76,7 +76,7 @@ public final class XmlParserTests {
* @throws IOException If an I/O error occurs. * @throws IOException If an I/O error occurs.
*/ */
@Test @Test
public void testParseReader() throws SAXException, IOException { public void parseReader() throws SAXException, IOException {
XmlParser parser = new XmlParser(); XmlParser parser = new XmlParser();
Reader reader = new StringReader("<alphabet><a>1</a><b>2</b><c>3</c></alphabet>"); Reader reader = new StringReader("<alphabet><a>1</a><b>2</b><c>3</c></alphabet>");
XmlNode root = parser.parse(reader); XmlNode root = parser.parse(reader);