diff --git a/build.gradle b/build.gradle index ec97b76..9bea661 100644 --- a/build.gradle +++ b/build.gradle @@ -131,7 +131,6 @@ compileJava { options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation'] } - tasks.named("dependencyUpdates").configure { rejectVersionIf { isNonStable(it.candidate.version) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/InfoTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/InfoTest.kt index 67ad8c8..04652ea 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/InfoTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/InfoTest.kt @@ -38,7 +38,7 @@ import net.thauvin.erik.mobibot.commands.Info.Companion.toUptime import org.testng.annotations.Test class InfoTest { - @Test + @Test(groups = ["commands"]) fun testToUptime() { assertThat(547800300076L.toUptime(), "full").isEqualTo("17 years 2 months 2 weeks 1 day 6 hours 45 minutes") assertThat(24300000L.toUptime(), "hours minutes").isEqualTo("6 hours 45 minutes") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/RecapTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/RecapTest.kt index ea3432e..37fbcd1 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/RecapTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/RecapTest.kt @@ -41,7 +41,7 @@ import assertk.assertions.size import org.testng.annotations.Test class RecapTest { - @Test + @Test(groups = ["commands"]) fun storeRecapTest() { for (i in 1..20) { Recap.storeRecap("sender$i", "test $i", false) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/LinksMgrTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/LinksMgrTest.kt index 551ee1d..47f3621 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/LinksMgrTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/LinksMgrTest.kt @@ -44,19 +44,19 @@ import org.testng.annotations.Test class LinksMgrTest { private val linksMgr = LinksMgr() - @Test + @Test(groups = ["commands", "links"]) fun fetchTitle() { assertThat(linksMgr.fetchTitle("https://erik.thauvin.net/"), "Erik").contains("Erik's Weblog") assertThat(linksMgr.fetchTitle("https://www.google.com/foo"), "Foo").isEqualTo(Constants.NO_TITLE) } - @Test + @Test(groups = ["commands", "links"]) fun testMatches() { assertThat(linksMgr.matches("https://www.example.com/"), "https").isTrue() assertThat(linksMgr.matches("HTTP://erik.thauvin.net/blog/ Erik's Weblog"), "HTTP").isTrue() } - @Test + @Test(groups = ["commands", "links"]) fun matchTagKeywordsTest() { linksMgr.setProperty(LinksMgr.KEYWORDS_PROP, "key1 key2,key3") val tags = mutableListOf() diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/ViewTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/ViewTest.kt index f5f30be..7ef0184 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/ViewTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/links/ViewTest.kt @@ -40,7 +40,7 @@ import net.thauvin.erik.mobibot.entries.EntryLink import org.testng.annotations.Test class ViewTest { - @Test + @Test(groups = ["commands", "links"]) fun testParseArgs() { val view = View() diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/seen/SeenTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/seen/SeenTest.kt index 59fa2b7..80c8450 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/seen/SeenTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/seen/SeenTest.kt @@ -59,7 +59,7 @@ class SeenTest { tmpFile.deleteIfExists() } - @Test(priority = 1) + @Test(priority = 1, groups = ["commands"]) fun loadTest() { seen.clear() assertThat(seen.seenNicks.isEmpty(), "nicknames map is not empty").isTrue() @@ -67,7 +67,7 @@ class SeenTest { assertThat(seen.seenNicks.containsKey(nick), "nick is missing").isTrue() } - @Test + @Test(groups = ["commands"]) fun addTest() { val last = seen.seenNicks[nick]?.lastSeen seen.add(nick.lowercase()) @@ -76,7 +76,7 @@ class SeenTest { assertThat(seen.seenNicks[nick]?.nick, "nick is not lowercase").isEqualTo(nick.lowercase()) } - @Test(priority = 10) + @Test(priority = 10, groups = ["commands"]) fun clearTest() { seen.clear() seen.save() diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessageTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessageTest.kt index 436b81d..1913312 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessageTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessageTest.kt @@ -50,7 +50,7 @@ class TellMessageTest { return Duration.between(date, LocalDateTime.now()).toMinutes() < 1 } - @Test + @Test(groups = ["commands", "tell"]) fun testTellMessage() { val message = "Test message." val recipient = "recipient" diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessagesMgrTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessagesMgrTest.kt index a2563c3..24c3bcf 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessagesMgrTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/commands/tell/TellMessagesMgrTest.kt @@ -68,7 +68,7 @@ class TellMessagesMgrTest { testFile.deleteIfExists() } - @Test + @Test(groups = ["commands", "tell"]) fun cleanTest() { testMessages.add(TellMessage("sender", "recipient", "message").apply { queued = LocalDateTime.now().minusDays(maxDays) @@ -79,7 +79,7 @@ class TellMessagesMgrTest { assertThat(testMessages.size, "size-- after clean").isEqualTo(size - 1) } - @Test + @Test(groups = ["commands", "tell"]) fun loadTest() { val messages = TellMessagesMgr.load(testFile.toAbsolutePath().toString()) for (i in messages.indices) { diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntriesUtilsTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntriesUtilsTest.kt index 9f4821d..06e50d8 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntriesUtilsTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntriesUtilsTest.kt @@ -59,17 +59,17 @@ class EntriesUtilsTest { } } - @Test + @Test(groups = ["entries"]) fun buildLinkLabelTest() { assertThat(1.toLinkLabel()).isEqualTo("${Constants.LINK_CMD}2") } - @Test + @Test(groups = ["entries"]) fun buildCommentTest() { assertThat(buildComment(0, 0, comment)).isEqualTo("${Constants.LINK_CMD}1.1: [nick] comment") } - @Test + @Test(groups = ["entries"]) fun buildLinkTest() { for (i in links.indices) { assertThat( @@ -81,7 +81,7 @@ class EntriesUtilsTest { assertThat(buildLink(0, links.first(), isView = true), "isView = true").contains("[+1]") } - @Test + @Test(groups = ["entries"]) fun buildTagsTest() { for (i in links.indices) { assertThat( diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntryLinkTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntryLinkTest.kt index 36244de..a88c9a5 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntryLinkTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/entries/EntryLinkTest.kt @@ -58,7 +58,7 @@ class EntryLinkTest { listOf("tag1", "tag2", "tag3", "TAG4", "Tag5") ) - @Test + @Test(groups = ["entries"]) fun testAddDeleteComment() { var i = 0 while (i < 5) { @@ -91,7 +91,7 @@ class EntryLinkTest { assertThat(entryLink.deleteComment(comment), "comment is already deleted").isFalse() } - @Test + @Test(groups = ["entries"]) fun testConstructor() { val tag = "test" val tags = listOf(SyndCategoryImpl().apply { name = tag }) @@ -101,7 +101,7 @@ class EntryLinkTest { assertThat(link.pinboardTags, "check pinboard tags").isEqualTo("nick,$tag") } - @Test + @Test(groups = ["entries"]) fun testMatches() { assertThat(entryLink.matches("mobitopia"), "match mobitopia").isTrue() assertThat(entryLink.matches("skynx"), "match nick").isTrue() @@ -112,7 +112,7 @@ class EntryLinkTest { } - @Test + @Test(groups = ["entries"]) fun testTags() { val tags: List = entryLink.tags for ((i, tag) in tags.withIndex()) { diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/entries/FeedMgrTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/entries/FeedMgrTest.kt index da0877d..31cfb99 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/entries/FeedMgrTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/entries/FeedMgrTest.kt @@ -61,7 +61,7 @@ class FeedMgrTest { entries.backlogs = "https://www.mobitopia.org/mobibot/logs" } - @Test + @Test(groups = ["entries"]) fun testFeedMgr() { // Load the feed assertThat(FeedsMgr.loadFeed(entries), "pubDate").isEqualTo("2021-10-31") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CalcTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CalcTest.kt index 3d125f8..e9c969e 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CalcTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CalcTest.kt @@ -44,7 +44,7 @@ import org.testng.annotations.Test * The `CalcTest` class. */ class CalcTest { - @Test + @Test(groups = ["modules"]) fun testCalculate() { assertThat(calculate("1 + 1"), "calculate(1+1)").isEqualTo("1+1 = ${2.bold()}") assertThat(calculate("1 -3"), "calculate(1 -3)").isEqualTo("1-3 = ${(-2).bold()}") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CryptoPricesTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CryptoPricesTest.kt index 1fb689f..d03c67a 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CryptoPricesTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CryptoPricesTest.kt @@ -53,7 +53,7 @@ class CryptoPricesTest { loadCurrencies() } - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun testMarketPrice() { var price = currentPrice(listOf("BTC")) @@ -71,7 +71,7 @@ class CryptoPricesTest { } } - @Test + @Test(groups = ["modules"]) fun testGetCurrencyName() { assertThat(getCurrencyName("USD")).isEqualTo("US Dollar") assertThat(getCurrencyName("EUR")).isEqualTo("Euro") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.kt index 05447e1..0cd20fe 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.kt @@ -56,7 +56,7 @@ class CurrencyConverterTest { loadSymbols() } - @Test + @Test(groups = ["modules"]) fun testConvertCurrency() { assertThat( convertCurrency("100 USD to EUR").msg, diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/DiceTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/DiceTest.kt index 2befdb6..e07037c 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/DiceTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/DiceTest.kt @@ -39,7 +39,7 @@ import assertk.assertions.matches import org.testng.annotations.Test class DiceTest { - @Test + @Test(groups = ["modules"]) fun testRoll() { assertThat(Dice.roll(1, 1), "1d1").isEqualTo("\u00021\u0002") assertThat(Dice.roll(2, 1), "2d1") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt index 1c40d56..5629f7b 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/GoogleSearchTest.kt @@ -51,7 +51,7 @@ import org.testng.annotations.Test * The `GoogleSearchTest` class. */ class GoogleSearchTest : LocalProperties() { - @Test + @Test(groups = ["modules"]) fun testAPIKeys() { assertThat( searchGoogle("", "apikey", "cssKey").first(), @@ -65,7 +65,7 @@ class GoogleSearchTest : LocalProperties() { .isInstanceOf(ModuleException::class.java).hasNoCause() } - @Test(groups = ["no-ci"]) + @Test(groups = ["no-ci", "modules"]) @Throws(ModuleException::class) fun testSearchGoogle() { val apiKey = getProperty(GoogleSearch.GOOGLE_API_KEY_PROP) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/JokeTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/JokeTest.kt index 65c259b..0aea63e 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/JokeTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/JokeTest.kt @@ -42,7 +42,7 @@ import org.testng.annotations.Test * The `JokeTest` class. */ class JokeTest { - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun testRandomJoke() { assertThat(randomJoke().msg, "randomJoke() > 0").all { diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt index b915357..aa5de8c 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/LookupTest.kt @@ -42,7 +42,7 @@ import org.testng.annotations.Test * The `Lookup Test` class. */ class LookupTest { - @Test + @Test(groups = ["modules"]) @Throws(Exception::class) fun testLookup() { var result = nslookup("apple.com") @@ -52,7 +52,7 @@ class LookupTest { assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us") } - @Test + @Test(groups = ["modules"]) @Throws(Exception::class) fun testWhois() { val result = whois("17.178.96.59", Lookup.WHOIS_HOST) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/ModuleExceptionTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/ModuleExceptionTest.kt index 37ba63b..49fc5a9 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/ModuleExceptionTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/ModuleExceptionTest.kt @@ -74,7 +74,7 @@ class ModuleExceptionTest { assertThat(e, "get message").hasMessage(message) } - @Test + @Test(groups = ["modules"]) fun testSanitizeMessage() { val apiKey = "1234567890" var e = ModuleException(debugMessage, message, IOException("URL http://foo.com?apiKey=$apiKey&userID=me")) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/PingTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/PingTest.kt index 247bf94..f17e1fa 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/PingTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/PingTest.kt @@ -41,12 +41,12 @@ import org.testng.annotations.Test * The `PingTest` class. */ class PingTest { - @Test + @Test(groups = ["modules"]) fun testPingsArray() { assertThat(Ping.PINGS, "Pings array is not empty.").isNotEmpty() } - @Test + @Test(groups = ["modules"]) fun testRandomPing() { for (i in 0..9) { assertThat(Ping.PINGS, "Random ping $i").contains(randomPing()) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissorsTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissorsTest.kt index 66e95d0..dbe4f36 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissorsTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/RockPaperScissorsTest.kt @@ -37,7 +37,7 @@ import assertk.assertions.isEqualTo import org.testng.annotations.Test class RockPaperScissorsTest { - @Test + @Test(groups = ["modules"]) fun testWinLoseOrDraw() { assertThat(RockPaperScissors.winLoseOrDraw("scissors", "paper"), "scissors vs. paper").isEqualTo("win") assertThat(RockPaperScissors.winLoseOrDraw("paper", "rock"), "paper vs. rock").isEqualTo("win") diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/StockQuoteTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/StockQuoteTest.kt index 57dcb4c..81f77bd 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/StockQuoteTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/StockQuoteTest.kt @@ -55,7 +55,7 @@ class StockQuoteTest : LocalProperties() { return "${label}:[ ]+[0-9.]+".prependIndent() } - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun testGetQuote() { val apiKey = getProperty(StockQuote.ALPHAVANTAGE_API_KEY_PROP) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/TwitterTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/TwitterTest.kt index 29ae3c4..dd994a3 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/TwitterTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/TwitterTest.kt @@ -54,7 +54,7 @@ class TwitterTest : LocalProperties() { } } - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun testPostTwitter() { val msg = "Testing Twitter API from $ci" diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Weather2Test.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Weather2Test.kt index 315fa06..ebd704b 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/Weather2Test.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/Weather2Test.kt @@ -55,13 +55,13 @@ import org.testng.annotations.Test * The `Weather2Test` class. */ class Weather2Test : LocalProperties() { - @Test + @Test(groups = ["modules"]) fun testFtoC() { val t = ftoC(32.0) assertThat(t.second, "32 °F is 0 °C").isEqualTo(0) } - @Test + @Test(groups = ["modules"]) fun testGetCountry() { assertThat(getCountry("foo"), "not a country").isEqualTo(OWM.Country.UNITED_STATES) assertThat(getCountry("fr"), "fr is france").isEqualTo(OWM.Country.FRANCE) @@ -73,13 +73,13 @@ class Weather2Test : LocalProperties() { } } - @Test + @Test(groups = ["modules"]) fun testMphToKmh() { val w = mphToKmh(0.62) assertThat(w.second, "0.62 mph is 1 km/h").isEqualTo(1) } - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun testWeather() { var messages = getWeather("98204", getProperty(OWM_API_KEY_PROP)) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/WolframAlphaTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/WolframAlphaTest.kt index 3150f2f..62f3bf6 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/WolframAlphaTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/WolframAlphaTest.kt @@ -41,7 +41,7 @@ import net.thauvin.erik.mobibot.LocalProperties import org.testng.annotations.Test class WolframAlphaTest : LocalProperties() { - @Test + @Test(groups = ["modules"]) @Throws(ModuleException::class) fun queryWolframTest() { val apiKey = getProperty(WolframAlpha.WOLFRAM_API_KEY_PROP) diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/modules/WordTimeTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/modules/WordTimeTest.kt index 09ac600..31e3d4a 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/modules/WordTimeTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/modules/WordTimeTest.kt @@ -48,7 +48,7 @@ import java.time.ZoneId * The `WordTimeTest` class. */ class WordTimeTest { - @Test + @Test(groups = ["modules"]) fun testTime() { assertThat(time(), "no zone").matches( ("The time is ${Colors.BOLD}\\d{1,2}:\\d{2}${Colors.BOLD} " + @@ -63,7 +63,7 @@ class WordTimeTest { assertThat(time("BEAT"), BEATS_KEYWORD).matches("[\\w ]+ .?@\\d{3}+.? .beats".toRegex()) } - @Test + @Test(groups = ["modules"]) fun testZones() { COUNTRIES_MAP.filter { it.value != BEATS_KEYWORD }.forEach { assertThat { ZoneId.of(it.value) }.isSuccess()