Added test groups
This commit is contained in:
parent
893d554136
commit
646682e2a9
26 changed files with 44 additions and 45 deletions
|
@ -131,7 +131,6 @@ compileJava {
|
||||||
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tasks.named("dependencyUpdates").configure {
|
tasks.named("dependencyUpdates").configure {
|
||||||
rejectVersionIf {
|
rejectVersionIf {
|
||||||
isNonStable(it.candidate.version)
|
isNonStable(it.candidate.version)
|
||||||
|
|
|
@ -38,7 +38,7 @@ import net.thauvin.erik.mobibot.commands.Info.Companion.toUptime
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class InfoTest {
|
class InfoTest {
|
||||||
@Test
|
@Test(groups = ["commands"])
|
||||||
fun testToUptime() {
|
fun testToUptime() {
|
||||||
assertThat(547800300076L.toUptime(), "full").isEqualTo("17 years 2 months 2 weeks 1 day 6 hours 45 minutes")
|
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")
|
assertThat(24300000L.toUptime(), "hours minutes").isEqualTo("6 hours 45 minutes")
|
||||||
|
|
|
@ -41,7 +41,7 @@ import assertk.assertions.size
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class RecapTest {
|
class RecapTest {
|
||||||
@Test
|
@Test(groups = ["commands"])
|
||||||
fun storeRecapTest() {
|
fun storeRecapTest() {
|
||||||
for (i in 1..20) {
|
for (i in 1..20) {
|
||||||
Recap.storeRecap("sender$i", "test $i", false)
|
Recap.storeRecap("sender$i", "test $i", false)
|
||||||
|
|
|
@ -44,19 +44,19 @@ import org.testng.annotations.Test
|
||||||
class LinksMgrTest {
|
class LinksMgrTest {
|
||||||
private val linksMgr = LinksMgr()
|
private val linksMgr = LinksMgr()
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "links"])
|
||||||
fun fetchTitle() {
|
fun fetchTitle() {
|
||||||
assertThat(linksMgr.fetchTitle("https://erik.thauvin.net/"), "Erik").contains("Erik's Weblog")
|
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)
|
assertThat(linksMgr.fetchTitle("https://www.google.com/foo"), "Foo").isEqualTo(Constants.NO_TITLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "links"])
|
||||||
fun testMatches() {
|
fun testMatches() {
|
||||||
assertThat(linksMgr.matches("https://www.example.com/"), "https").isTrue()
|
assertThat(linksMgr.matches("https://www.example.com/"), "https").isTrue()
|
||||||
assertThat(linksMgr.matches("HTTP://erik.thauvin.net/blog/ Erik's Weblog"), "HTTP").isTrue()
|
assertThat(linksMgr.matches("HTTP://erik.thauvin.net/blog/ Erik's Weblog"), "HTTP").isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "links"])
|
||||||
fun matchTagKeywordsTest() {
|
fun matchTagKeywordsTest() {
|
||||||
linksMgr.setProperty(LinksMgr.KEYWORDS_PROP, "key1 key2,key3")
|
linksMgr.setProperty(LinksMgr.KEYWORDS_PROP, "key1 key2,key3")
|
||||||
val tags = mutableListOf<String>()
|
val tags = mutableListOf<String>()
|
||||||
|
|
|
@ -40,7 +40,7 @@ import net.thauvin.erik.mobibot.entries.EntryLink
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class ViewTest {
|
class ViewTest {
|
||||||
@Test
|
@Test(groups = ["commands", "links"])
|
||||||
fun testParseArgs() {
|
fun testParseArgs() {
|
||||||
val view = View()
|
val view = View()
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SeenTest {
|
||||||
tmpFile.deleteIfExists()
|
tmpFile.deleteIfExists()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(priority = 1)
|
@Test(priority = 1, groups = ["commands"])
|
||||||
fun loadTest() {
|
fun loadTest() {
|
||||||
seen.clear()
|
seen.clear()
|
||||||
assertThat(seen.seenNicks.isEmpty(), "nicknames map is not empty").isTrue()
|
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()
|
assertThat(seen.seenNicks.containsKey(nick), "nick is missing").isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands"])
|
||||||
fun addTest() {
|
fun addTest() {
|
||||||
val last = seen.seenNicks[nick]?.lastSeen
|
val last = seen.seenNicks[nick]?.lastSeen
|
||||||
seen.add(nick.lowercase())
|
seen.add(nick.lowercase())
|
||||||
|
@ -76,7 +76,7 @@ class SeenTest {
|
||||||
assertThat(seen.seenNicks[nick]?.nick, "nick is not lowercase").isEqualTo(nick.lowercase())
|
assertThat(seen.seenNicks[nick]?.nick, "nick is not lowercase").isEqualTo(nick.lowercase())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(priority = 10)
|
@Test(priority = 10, groups = ["commands"])
|
||||||
fun clearTest() {
|
fun clearTest() {
|
||||||
seen.clear()
|
seen.clear()
|
||||||
seen.save()
|
seen.save()
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TellMessageTest {
|
||||||
return Duration.between(date, LocalDateTime.now()).toMinutes() < 1
|
return Duration.between(date, LocalDateTime.now()).toMinutes() < 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "tell"])
|
||||||
fun testTellMessage() {
|
fun testTellMessage() {
|
||||||
val message = "Test message."
|
val message = "Test message."
|
||||||
val recipient = "recipient"
|
val recipient = "recipient"
|
||||||
|
|
|
@ -68,7 +68,7 @@ class TellMessagesMgrTest {
|
||||||
testFile.deleteIfExists()
|
testFile.deleteIfExists()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "tell"])
|
||||||
fun cleanTest() {
|
fun cleanTest() {
|
||||||
testMessages.add(TellMessage("sender", "recipient", "message").apply {
|
testMessages.add(TellMessage("sender", "recipient", "message").apply {
|
||||||
queued = LocalDateTime.now().minusDays(maxDays)
|
queued = LocalDateTime.now().minusDays(maxDays)
|
||||||
|
@ -79,7 +79,7 @@ class TellMessagesMgrTest {
|
||||||
assertThat(testMessages.size, "size-- after clean").isEqualTo(size - 1)
|
assertThat(testMessages.size, "size-- after clean").isEqualTo(size - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["commands", "tell"])
|
||||||
fun loadTest() {
|
fun loadTest() {
|
||||||
val messages = TellMessagesMgr.load(testFile.toAbsolutePath().toString())
|
val messages = TellMessagesMgr.load(testFile.toAbsolutePath().toString())
|
||||||
for (i in messages.indices) {
|
for (i in messages.indices) {
|
||||||
|
|
|
@ -59,17 +59,17 @@ class EntriesUtilsTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun buildLinkLabelTest() {
|
fun buildLinkLabelTest() {
|
||||||
assertThat(1.toLinkLabel()).isEqualTo("${Constants.LINK_CMD}2")
|
assertThat(1.toLinkLabel()).isEqualTo("${Constants.LINK_CMD}2")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun buildCommentTest() {
|
fun buildCommentTest() {
|
||||||
assertThat(buildComment(0, 0, comment)).isEqualTo("${Constants.LINK_CMD}1.1: [nick] comment")
|
assertThat(buildComment(0, 0, comment)).isEqualTo("${Constants.LINK_CMD}1.1: [nick] comment")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun buildLinkTest() {
|
fun buildLinkTest() {
|
||||||
for (i in links.indices) {
|
for (i in links.indices) {
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -81,7 +81,7 @@ class EntriesUtilsTest {
|
||||||
assertThat(buildLink(0, links.first(), isView = true), "isView = true").contains("[+1]")
|
assertThat(buildLink(0, links.first(), isView = true), "isView = true").contains("[+1]")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun buildTagsTest() {
|
fun buildTagsTest() {
|
||||||
for (i in links.indices) {
|
for (i in links.indices) {
|
||||||
assertThat(
|
assertThat(
|
||||||
|
|
|
@ -58,7 +58,7 @@ class EntryLinkTest {
|
||||||
listOf("tag1", "tag2", "tag3", "TAG4", "Tag5")
|
listOf("tag1", "tag2", "tag3", "TAG4", "Tag5")
|
||||||
)
|
)
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun testAddDeleteComment() {
|
fun testAddDeleteComment() {
|
||||||
var i = 0
|
var i = 0
|
||||||
while (i < 5) {
|
while (i < 5) {
|
||||||
|
@ -91,7 +91,7 @@ class EntryLinkTest {
|
||||||
assertThat(entryLink.deleteComment(comment), "comment is already deleted").isFalse()
|
assertThat(entryLink.deleteComment(comment), "comment is already deleted").isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun testConstructor() {
|
fun testConstructor() {
|
||||||
val tag = "test"
|
val tag = "test"
|
||||||
val tags = listOf(SyndCategoryImpl().apply { name = tag })
|
val tags = listOf(SyndCategoryImpl().apply { name = tag })
|
||||||
|
@ -101,7 +101,7 @@ class EntryLinkTest {
|
||||||
assertThat(link.pinboardTags, "check pinboard tags").isEqualTo("nick,$tag")
|
assertThat(link.pinboardTags, "check pinboard tags").isEqualTo("nick,$tag")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun testMatches() {
|
fun testMatches() {
|
||||||
assertThat(entryLink.matches("mobitopia"), "match mobitopia").isTrue()
|
assertThat(entryLink.matches("mobitopia"), "match mobitopia").isTrue()
|
||||||
assertThat(entryLink.matches("skynx"), "match nick").isTrue()
|
assertThat(entryLink.matches("skynx"), "match nick").isTrue()
|
||||||
|
@ -112,7 +112,7 @@ class EntryLinkTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun testTags() {
|
fun testTags() {
|
||||||
val tags: List<SyndCategory> = entryLink.tags
|
val tags: List<SyndCategory> = entryLink.tags
|
||||||
for ((i, tag) in tags.withIndex()) {
|
for ((i, tag) in tags.withIndex()) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ class FeedMgrTest {
|
||||||
entries.backlogs = "https://www.mobitopia.org/mobibot/logs"
|
entries.backlogs = "https://www.mobitopia.org/mobibot/logs"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["entries"])
|
||||||
fun testFeedMgr() {
|
fun testFeedMgr() {
|
||||||
// Load the feed
|
// Load the feed
|
||||||
assertThat(FeedsMgr.loadFeed(entries), "pubDate").isEqualTo("2021-10-31")
|
assertThat(FeedsMgr.loadFeed(entries), "pubDate").isEqualTo("2021-10-31")
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.testng.annotations.Test
|
||||||
* The `CalcTest` class.
|
* The `CalcTest` class.
|
||||||
*/
|
*/
|
||||||
class CalcTest {
|
class CalcTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testCalculate() {
|
fun testCalculate() {
|
||||||
assertThat(calculate("1 + 1"), "calculate(1+1)").isEqualTo("1+1 = ${2.bold()}")
|
assertThat(calculate("1 + 1"), "calculate(1+1)").isEqualTo("1+1 = ${2.bold()}")
|
||||||
assertThat(calculate("1 -3"), "calculate(1 -3)").isEqualTo("1-3 = ${(-2).bold()}")
|
assertThat(calculate("1 -3"), "calculate(1 -3)").isEqualTo("1-3 = ${(-2).bold()}")
|
||||||
|
|
|
@ -53,7 +53,7 @@ class CryptoPricesTest {
|
||||||
loadCurrencies()
|
loadCurrencies()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testMarketPrice() {
|
fun testMarketPrice() {
|
||||||
var price = currentPrice(listOf("BTC"))
|
var price = currentPrice(listOf("BTC"))
|
||||||
|
@ -71,7 +71,7 @@ class CryptoPricesTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testGetCurrencyName() {
|
fun testGetCurrencyName() {
|
||||||
assertThat(getCurrencyName("USD")).isEqualTo("US Dollar")
|
assertThat(getCurrencyName("USD")).isEqualTo("US Dollar")
|
||||||
assertThat(getCurrencyName("EUR")).isEqualTo("Euro")
|
assertThat(getCurrencyName("EUR")).isEqualTo("Euro")
|
||||||
|
|
|
@ -56,7 +56,7 @@ class CurrencyConverterTest {
|
||||||
loadSymbols()
|
loadSymbols()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testConvertCurrency() {
|
fun testConvertCurrency() {
|
||||||
assertThat(
|
assertThat(
|
||||||
convertCurrency("100 USD to EUR").msg,
|
convertCurrency("100 USD to EUR").msg,
|
||||||
|
|
|
@ -39,7 +39,7 @@ import assertk.assertions.matches
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class DiceTest {
|
class DiceTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testRoll() {
|
fun testRoll() {
|
||||||
assertThat(Dice.roll(1, 1), "1d1").isEqualTo("\u00021\u0002")
|
assertThat(Dice.roll(1, 1), "1d1").isEqualTo("\u00021\u0002")
|
||||||
assertThat(Dice.roll(2, 1), "2d1")
|
assertThat(Dice.roll(2, 1), "2d1")
|
||||||
|
|
|
@ -51,7 +51,7 @@ import org.testng.annotations.Test
|
||||||
* The `GoogleSearchTest` class.
|
* The `GoogleSearchTest` class.
|
||||||
*/
|
*/
|
||||||
class GoogleSearchTest : LocalProperties() {
|
class GoogleSearchTest : LocalProperties() {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testAPIKeys() {
|
fun testAPIKeys() {
|
||||||
assertThat(
|
assertThat(
|
||||||
searchGoogle("", "apikey", "cssKey").first(),
|
searchGoogle("", "apikey", "cssKey").first(),
|
||||||
|
@ -65,7 +65,7 @@ class GoogleSearchTest : LocalProperties() {
|
||||||
.isInstanceOf(ModuleException::class.java).hasNoCause()
|
.isInstanceOf(ModuleException::class.java).hasNoCause()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(groups = ["no-ci"])
|
@Test(groups = ["no-ci", "modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testSearchGoogle() {
|
fun testSearchGoogle() {
|
||||||
val apiKey = getProperty(GoogleSearch.GOOGLE_API_KEY_PROP)
|
val apiKey = getProperty(GoogleSearch.GOOGLE_API_KEY_PROP)
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.testng.annotations.Test
|
||||||
* The `JokeTest` class.
|
* The `JokeTest` class.
|
||||||
*/
|
*/
|
||||||
class JokeTest {
|
class JokeTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testRandomJoke() {
|
fun testRandomJoke() {
|
||||||
assertThat(randomJoke().msg, "randomJoke() > 0").all {
|
assertThat(randomJoke().msg, "randomJoke() > 0").all {
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.testng.annotations.Test
|
||||||
* The `Lookup Test` class.
|
* The `Lookup Test` class.
|
||||||
*/
|
*/
|
||||||
class LookupTest {
|
class LookupTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testLookup() {
|
fun testLookup() {
|
||||||
var result = nslookup("apple.com")
|
var result = nslookup("apple.com")
|
||||||
|
@ -52,7 +52,7 @@ class LookupTest {
|
||||||
assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us")
|
assertThat(result, "lookup(204.122.17.9)").contains("nix3.thauvin.us")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
fun testWhois() {
|
fun testWhois() {
|
||||||
val result = whois("17.178.96.59", Lookup.WHOIS_HOST)
|
val result = whois("17.178.96.59", Lookup.WHOIS_HOST)
|
||||||
|
|
|
@ -74,7 +74,7 @@ class ModuleExceptionTest {
|
||||||
assertThat(e, "get message").hasMessage(message)
|
assertThat(e, "get message").hasMessage(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testSanitizeMessage() {
|
fun testSanitizeMessage() {
|
||||||
val apiKey = "1234567890"
|
val apiKey = "1234567890"
|
||||||
var e = ModuleException(debugMessage, message, IOException("URL http://foo.com?apiKey=$apiKey&userID=me"))
|
var e = ModuleException(debugMessage, message, IOException("URL http://foo.com?apiKey=$apiKey&userID=me"))
|
||||||
|
|
|
@ -41,12 +41,12 @@ import org.testng.annotations.Test
|
||||||
* The `PingTest` class.
|
* The `PingTest` class.
|
||||||
*/
|
*/
|
||||||
class PingTest {
|
class PingTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testPingsArray() {
|
fun testPingsArray() {
|
||||||
assertThat(Ping.PINGS, "Pings array is not empty.").isNotEmpty()
|
assertThat(Ping.PINGS, "Pings array is not empty.").isNotEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testRandomPing() {
|
fun testRandomPing() {
|
||||||
for (i in 0..9) {
|
for (i in 0..9) {
|
||||||
assertThat(Ping.PINGS, "Random ping $i").contains(randomPing())
|
assertThat(Ping.PINGS, "Random ping $i").contains(randomPing())
|
||||||
|
|
|
@ -37,7 +37,7 @@ import assertk.assertions.isEqualTo
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class RockPaperScissorsTest {
|
class RockPaperScissorsTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testWinLoseOrDraw() {
|
fun testWinLoseOrDraw() {
|
||||||
assertThat(RockPaperScissors.winLoseOrDraw("scissors", "paper"), "scissors vs. paper").isEqualTo("win")
|
assertThat(RockPaperScissors.winLoseOrDraw("scissors", "paper"), "scissors vs. paper").isEqualTo("win")
|
||||||
assertThat(RockPaperScissors.winLoseOrDraw("paper", "rock"), "paper vs. rock").isEqualTo("win")
|
assertThat(RockPaperScissors.winLoseOrDraw("paper", "rock"), "paper vs. rock").isEqualTo("win")
|
||||||
|
|
|
@ -55,7 +55,7 @@ class StockQuoteTest : LocalProperties() {
|
||||||
return "${label}:[ ]+[0-9.]+".prependIndent()
|
return "${label}:[ ]+[0-9.]+".prependIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testGetQuote() {
|
fun testGetQuote() {
|
||||||
val apiKey = getProperty(StockQuote.ALPHAVANTAGE_API_KEY_PROP)
|
val apiKey = getProperty(StockQuote.ALPHAVANTAGE_API_KEY_PROP)
|
||||||
|
|
|
@ -54,7 +54,7 @@ class TwitterTest : LocalProperties() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testPostTwitter() {
|
fun testPostTwitter() {
|
||||||
val msg = "Testing Twitter API from $ci"
|
val msg = "Testing Twitter API from $ci"
|
||||||
|
|
|
@ -55,13 +55,13 @@ import org.testng.annotations.Test
|
||||||
* The `Weather2Test` class.
|
* The `Weather2Test` class.
|
||||||
*/
|
*/
|
||||||
class Weather2Test : LocalProperties() {
|
class Weather2Test : LocalProperties() {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testFtoC() {
|
fun testFtoC() {
|
||||||
val t = ftoC(32.0)
|
val t = ftoC(32.0)
|
||||||
assertThat(t.second, "32 °F is 0 °C").isEqualTo(0)
|
assertThat(t.second, "32 °F is 0 °C").isEqualTo(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testGetCountry() {
|
fun testGetCountry() {
|
||||||
assertThat(getCountry("foo"), "not a country").isEqualTo(OWM.Country.UNITED_STATES)
|
assertThat(getCountry("foo"), "not a country").isEqualTo(OWM.Country.UNITED_STATES)
|
||||||
assertThat(getCountry("fr"), "fr is france").isEqualTo(OWM.Country.FRANCE)
|
assertThat(getCountry("fr"), "fr is france").isEqualTo(OWM.Country.FRANCE)
|
||||||
|
@ -73,13 +73,13 @@ class Weather2Test : LocalProperties() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testMphToKmh() {
|
fun testMphToKmh() {
|
||||||
val w = mphToKmh(0.62)
|
val w = mphToKmh(0.62)
|
||||||
assertThat(w.second, "0.62 mph is 1 km/h").isEqualTo(1)
|
assertThat(w.second, "0.62 mph is 1 km/h").isEqualTo(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun testWeather() {
|
fun testWeather() {
|
||||||
var messages = getWeather("98204", getProperty(OWM_API_KEY_PROP))
|
var messages = getWeather("98204", getProperty(OWM_API_KEY_PROP))
|
||||||
|
|
|
@ -41,7 +41,7 @@ import net.thauvin.erik.mobibot.LocalProperties
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
|
||||||
class WolframAlphaTest : LocalProperties() {
|
class WolframAlphaTest : LocalProperties() {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
@Throws(ModuleException::class)
|
@Throws(ModuleException::class)
|
||||||
fun queryWolframTest() {
|
fun queryWolframTest() {
|
||||||
val apiKey = getProperty(WolframAlpha.WOLFRAM_API_KEY_PROP)
|
val apiKey = getProperty(WolframAlpha.WOLFRAM_API_KEY_PROP)
|
||||||
|
|
|
@ -48,7 +48,7 @@ import java.time.ZoneId
|
||||||
* The `WordTimeTest` class.
|
* The `WordTimeTest` class.
|
||||||
*/
|
*/
|
||||||
class WordTimeTest {
|
class WordTimeTest {
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testTime() {
|
fun testTime() {
|
||||||
assertThat(time(), "no zone").matches(
|
assertThat(time(), "no zone").matches(
|
||||||
("The time is ${Colors.BOLD}\\d{1,2}:\\d{2}${Colors.BOLD} " +
|
("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())
|
assertThat(time("BEAT"), BEATS_KEYWORD).matches("[\\w ]+ .?@\\d{3}+.? .beats".toRegex())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test(groups = ["modules"])
|
||||||
fun testZones() {
|
fun testZones() {
|
||||||
COUNTRIES_MAP.filter { it.value != BEATS_KEYWORD }.forEach {
|
COUNTRIES_MAP.filter { it.value != BEATS_KEYWORD }.forEach {
|
||||||
assertThat { ZoneId.of(it.value) }.isSuccess()
|
assertThat { ZoneId.of(it.value) }.isSuccess()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue