aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-17 12:31:14 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-17 12:31:14 +0200
commit61a018ba4e1a3cfa249c4809262f607820b3f811 (patch)
treeb4ff2e96fe983154915cdbabc15448f5426ae507 /src/test/java/at/hannibal2/skyhanni
parent48a41d5dd03a7fa591827f3bcb0f9d6f2dc27e9a (diff)
downloadskyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.tar.gz
skyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.tar.bz2
skyhanni-61a018ba4e1a3cfa249c4809262f607820b3f811.zip
code cleanup
Diffstat (limited to 'src/test/java/at/hannibal2/skyhanni')
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/garden/VisitorAPITest.kt40
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt38
-rw-r--r--src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt36
3 files changed, 60 insertions, 54 deletions
diff --git a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorAPITest.kt b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorAPITest.kt
index 74baf866a..c8e7923f7 100644
--- a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorAPITest.kt
+++ b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorAPITest.kt
@@ -21,31 +21,37 @@ class VisitorAPITest {
// To short
assert(
- VisitorAPI.isVisitorInfo(mutableListOf(
- "§a§lVisitor Info",
- "§7§oClick to view info about this visitor."
- )) == false
+ !VisitorAPI.isVisitorInfo(
+ mutableListOf(
+ "§a§lVisitor Info",
+ "§7§oClick to view info about this visitor."
+ )
+ )
)
// To long
assert(
- VisitorAPI.isVisitorInfo(mutableListOf(
- "§a§lVisitor Info",
- "§7§oClick to view info about this visitor.",
- "§7§oClick to view info about this visitor.",
- "§7§oClick to view info about this visitor.",
- "§7§oClick to view info about this visitor.",
- )) == false
+ !VisitorAPI.isVisitorInfo(
+ mutableListOf(
+ "§a§lVisitor Info",
+ "§7§oClick to view info about this visitor.",
+ "§7§oClick to view info about this visitor.",
+ "§7§oClick to view info about this visitor.",
+ "§7§oClick to view info about this visitor.",
+ )
+ )
)
// Third line is §7Offers Accepted: §a
assert(
- VisitorAPI.isVisitorInfo(mutableListOf(
- "§a§lVisitor Info",
- "§7§oClick to view info about this visitor.",
- "§7§oClick to view info about this visitor.",
- "§7Offers Accepted: §a",
- )) == true
+ VisitorAPI.isVisitorInfo(
+ mutableListOf(
+ "§a§lVisitor Info",
+ "§7§oClick to view info about this visitor.",
+ "§7§oClick to view info about this visitor.",
+ "§7Offers Accepted: §a",
+ )
+ )
)
}
} \ No newline at end of file
diff --git a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
index 13e96a019..c95e4ec03 100644
--- a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
+++ b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorListenerTest.kt
@@ -12,9 +12,9 @@ import io.mockk.verify
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-
class VisitorListenerTest {
private lateinit var listener: VisitorListener
+
@BeforeEach
fun setUp() {
mockkObject(GardenAPI)
@@ -32,14 +32,16 @@ class VisitorListenerTest {
@Test
fun `onTablistUpdate it should add new visitors to the list`() {
listener.onTabListUpdate(
- TabListUpdateEvent(mutableListOf(
- "§b§lVisitors:",
- "§cSpaceman",
- "§cGrandma Wolf",
- "ThePlayerName",
- "Jacob",
- "",
- ))
+ TabListUpdateEvent(
+ mutableListOf(
+ "§b§lVisitors:",
+ "§cSpaceman",
+ "§cGrandma Wolf",
+ "ThePlayerName",
+ "Jacob",
+ "",
+ )
+ )
)
verify { VisitorAPI.addVisitor("§fJacob") }
@@ -50,14 +52,13 @@ class VisitorListenerTest {
@Test
fun `onTablistUpdate it should remove visitors from the list`() {
every { VisitorAPI.getVisitors() } returns listOf(
- mockk { every { visitorName } returns "§fJacob" },
+ mockk { every { visitorName } returns "§fJacob" },
)
listener.onTabListUpdate(
- TabListUpdateEvent(mutableListOf(
- "§b§lVisitors:",
- "",
- ))
+ TabListUpdateEvent(
+ mutableListOf("§b§lVisitors:", "")
+ )
)
verify { VisitorAPI.removeVisitor("§fJacob") }
@@ -66,16 +67,15 @@ class VisitorListenerTest {
@Test
fun `onTablistUpdate it should not remove visitors if the timeout is not hit`() {
every { VisitorAPI.getVisitors() } returns listOf(
- mockk { every { visitorName } returns "§fJacob" },
+ mockk { every { visitorName } returns "§fJacob" },
)
every { LorenzUtils.lastWorldSwitch } returns System.currentTimeMillis()
listener.onTabListUpdate(
- TabListUpdateEvent(mutableListOf(
- "§b§lVisitors:",
- "",
- ))
+ TabListUpdateEvent(
+ mutableListOf("§b§lVisitors:", "")
+ )
)
verify(exactly = 0) { VisitorAPI.removeVisitor("§fJacob") }
diff --git a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
index 9418b3db8..0f2ad1fee 100644
--- a/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
+++ b/src/test/java/at/hannibal2/skyhanni/test/garden/VisitorToolTipParserTest.kt
@@ -6,18 +6,18 @@ import org.junit.jupiter.api.Test
class VisitorToolTipParserTest {
private val lore = mutableListOf(
- "§7Items Required:",
- " §aEnchanted Hay Bale §8x28",
- "",
- "§7Rewards:",
- " §8+§37.2k §7Farming XP",
- " §8+§215 §7Garden Experience",
- " §8+§c23 Copper",
- " §8+§b10 Bits",
- " §aJacob's Ticket",
- " §9Flowering Bouquet",
- "",
- "§eClick to give!"
+ "§7Items Required:",
+ " §aEnchanted Hay Bale §8x28",
+ "",
+ "§7Rewards:",
+ " §8+§37.2k §7Farming XP",
+ " §8+§215 §7Garden Experience",
+ " §8+§c23 Copper",
+ " §8+§b10 Bits",
+ " §aJacob's Ticket",
+ " §9Flowering Bouquet",
+ "",
+ "§eClick to give!"
)
@Test
@@ -39,12 +39,12 @@ class VisitorToolTipParserTest {
}
val assertions = mutableMapOf(
- "§7Farming XP" to 7200,
- "§7Garden Experience" to 15,
- "Copper" to 23,
- "Bits" to 10,
- "§aJacob's Ticket" to 1,
- "§9Flowering Bouquet" to 1
+ "§7Farming XP" to 7200,
+ "§7Garden Experience" to 15,
+ "Copper" to 23,
+ "Bits" to 10,
+ "§aJacob's Ticket" to 1,
+ "§9Flowering Bouquet" to 1
)
for ((itemName, amount) in assertions) {