[Test] Renamed PlayerKillTest methods

This commit is contained in:
Rsl1122 2018-10-13 09:52:08 +03:00
parent 82c183e63e
commit 71e2d52967
3 changed files with 120 additions and 69 deletions

View File

@ -152,6 +152,10 @@
<repository> <repository>
<id>sponge-repo</id> <id>sponge-repo</id>
<url>https://repo.spongepowered.org/maven</url> <url>https://repo.spongepowered.org/maven</url>
</repository>
<repository>
<id>velocity-repo</id>
<url>https://repo.velocitypowered.com/snapshots/</url>
</repository> </repository>
<repository> <repository>
<id>md_5-snapshots</id> <id>md_5-snapshots</id>
@ -298,6 +302,38 @@
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>text</artifactId>
<groupId>net.kyori</groupId>
</exclusion>
<exclusion>
<artifactId>toml4j</artifactId>
<groupId>com.moandjiezana.toml</groupId>
</exclusion>
<exclusion>
<artifactId>guice</artifactId>
<groupId>com.google.inject</groupId>
</exclusion>
<exclusion>
<artifactId>checker-qual</artifactId>
<groupId>org.checkerframework</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.spongepowered</groupId> <groupId>org.spongepowered</groupId>
@ -309,10 +345,6 @@
<artifactId>error_prone_annotations</artifactId> <artifactId>error_prone_annotations</artifactId>
<groupId>com.google.errorprone</groupId> <groupId>com.google.errorprone</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>guice</artifactId>
<groupId>com.google.inject</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
<groupId>com.github.ben-manes.caffeine</groupId> <groupId>com.github.ben-manes.caffeine</groupId>
@ -345,6 +377,10 @@
<artifactId>jsr305</artifactId> <artifactId>jsr305</artifactId>
<groupId>com.google.code.findbugs</groupId> <groupId>com.google.code.findbugs</groupId>
</exclusion> </exclusion>
<exclusion>
<artifactId>guice</artifactId>
<groupId>com.google.inject</groupId>
</exclusion>
<exclusion> <exclusion>
<artifactId>asm</artifactId> <artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId> <groupId>org.ow2.asm</groupId>

View File

@ -189,7 +189,7 @@ public class PingCountTimerBukkit extends AbsRunnable implements Listener {
if (player.isOnline()) { if (player.isOnline()) {
addPlayer(player); addPlayer(player);
} }
}// TODO Config }
}).runTaskLater(TimeAmount.toTicks(config.getNumber(Settings.PING_PLAYER_LOGIN_DELAY), TimeUnit.SECONDS)); }).runTaskLater(TimeAmount.toTicks(config.getNumber(Settings.PING_PLAYER_LOGIN_DELAY), TimeUnit.SECONDS));
} }

View File

@ -12,28 +12,43 @@ import utilities.RandomData;
import java.util.UUID; import java.util.UUID;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/** /**
* Tests for {@link PlayerKill}.
*
* @author Rsl1122 * @author Rsl1122
*/ */
public class PlayerKillTest { public class PlayerKillTest {
private String randomString = RandomData.randomString(10); private String weapon = RandomData.randomString(10);
private UUID testUUID = UUID.randomUUID(); private UUID testUUID = UUID.randomUUID();
private PlayerKill playerKill = new PlayerKill(testUUID, randomString, 100L); private PlayerKill underTest = new PlayerKill(testUUID, weapon, 100L);
@Test @Test
public void testGetVictim() { public void victimUUIDIsReturned() {
assertEquals(playerKill.getVictim(), testUUID); assertEquals(testUUID, underTest.getVictim());
} }
@Test @Test
public void testGetDate() { public void dateIsReturned() {
assertEquals(playerKill.getDate(), 100L); assertEquals(100L, underTest.getDate());
} }
@Test @Test
public void testGetWeapon() { public void weaponIsReturned() {
assertEquals(playerKill.getWeapon(), randomString); assertEquals(weapon, underTest.getWeapon());
}
@Test
public void noVictimFound() {
assertFalse(underTest.getVictimName().isPresent());
}
@Test
public void victimFound() {
String expectedName = "Test Victim";
PlayerKill underTest = new PlayerKill(testUUID, weapon, 100L, expectedName);
assertEquals("Test Victim", underTest.getVictimName().orElse("Unknown"));
} }
} }