diff --git a/src/main/java/net/thauvin/erik/mobibot/Mobibot.java b/src/main/java/net/thauvin/erik/mobibot/Mobibot.java index e050236..ffded5d 100644 --- a/src/main/java/net/thauvin/erik/mobibot/Mobibot.java +++ b/src/main/java/net/thauvin/erik/mobibot/Mobibot.java @@ -970,7 +970,7 @@ public class Mobibot extends PircBot { * @param message The message. */ public final void send(final String who, final Message message) { - send(message.isNotice() ? who : getChannel(), message.getMessage(), message.getColor(), message.isPrivate()); + send(message.isNotice() ? who : getChannel(), message.getText(), message.getColor(), message.isPrivate()); } /** diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java b/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java index a8a6a42..cc24afa 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/Joke.java @@ -118,7 +118,7 @@ public final class Joke extends ThreadedModule { @Override void run(final Mobibot bot, final String sender, final String cmd, final String arg, final boolean isPrivate) { try { - bot.send(Utils.cyan(randomJoke().getMessage())); + bot.send(Utils.cyan(randomJoke().getText())); } catch (ModuleException e) { bot.getLogger().warn(e.getDebugMessage(), e); bot.send(sender, e.getMessage(), isPrivate); diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java b/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java index 8991bc3..0ef6f15 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/Twitter.java @@ -142,7 +142,7 @@ public final class Twitter extends ThreadedModule { void run(final Mobibot bot, final String sender, final String cmd, final String message, final boolean isPrivate) { try { bot.send(sender, - post(sender, message + " (by " + sender + " on " + bot.getChannel() + ')', false).getMessage(), + post(sender, message + " (by " + sender + " on " + bot.getChannel() + ')', false).getText(), isPrivate); } catch (ModuleException e) { bot.getLogger().warn(e.getDebugMessage(), e); diff --git a/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.java b/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.java index 5435555..91fb27c 100644 --- a/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.java +++ b/src/main/java/net/thauvin/erik/mobibot/modules/WorldTime.java @@ -229,12 +229,12 @@ public final class WorldTime extends AbstractModule { } else { final Message msg = worldTime(args); if (isPrivate) { - bot.send(sender, msg.getMessage(), true); + bot.send(sender, msg.getText(), true); } else { if (msg.isError()) { - bot.send(sender, msg.getMessage(), false); + bot.send(sender, msg.getText(), false); } else { - bot.send(msg.getMessage()); + bot.send(msg.getText()); } } } diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.java b/src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.kt similarity index 71% rename from src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.java rename to src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.kt index dea79a6..6c00add 100644 --- a/src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.java +++ b/src/main/java/net/thauvin/erik/mobibot/msg/ErrorMessage.kt @@ -29,41 +29,38 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package net.thauvin.erik.mobibot.msg; +package net.thauvin.erik.mobibot.msg /** - * The ErrorMessage class. + * The `ErrorMessage` class. * - * @author Erik C. Thauvin + * @author [Erik C. Thauvin](https://erik.thauvin.net/) * @created 2019-04-07 * @since 1.0 */ -public class ErrorMessage extends Message { +class ErrorMessage : Message { /** * Creates a new error message. * - * @param message The error message. + * @param text The error message. */ - public ErrorMessage(final String message) { - super(); - this.setMessage(message); - this.setError(true); - this.setNotice(true); + constructor(text: String) : super() { + this.text = text + isError = true + isNotice = true } /** * Creates a new error message. * - * @param message The message. - * @param color The message color. + * @param text The message. + * @param color The message color. */ - @SuppressWarnings("unused") - public ErrorMessage(final String message, final String color) { - super(); - this.setMessage(message); - this.setError(true); - this.setNotice(true); - this.setColor(color); + @Suppress("unused") + constructor(text: String, color: String) : super() { + this.text = text + isError = true + isNotice = true + this.color = color } } diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/Message.java b/src/main/java/net/thauvin/erik/mobibot/msg/Message.java deleted file mode 100644 index cc70c2a..0000000 --- a/src/main/java/net/thauvin/erik/mobibot/msg/Message.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Message.java - * - * Copyright (c) 2004-2020, Erik C. Thauvin (erik@thauvin.net) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of this project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package net.thauvin.erik.mobibot.msg; - -import org.jibble.pircbot.Colors; - -/** - * The Message class. - * - * @author Erik C. Thauvin - * @created 2019-04-07 - * @since 1.0 - */ -public class Message { - private String color = Colors.NORMAL; - private boolean isError; - private boolean isNotice; - private boolean isPrivate; - private String msg = ""; - - /** - * Creates a new message. - */ - public Message() { - // This constructor is intentionally empty - } - - /** - * Creates a new message. - * - * @param message The message. - * @param isNotice The notice flag. - * @param isError The error flag. - * @param isPrivate The Private message - */ - @SuppressWarnings("unused") - public Message(final String message, final boolean isNotice, final boolean isError, final boolean isPrivate) { - msg = message; - this.isNotice = isNotice; - this.isError = isError; - this.isPrivate = isPrivate; - } - - - /** - * Creates a new message. - * - * @param message The message. - * @param isNotice The notice flag. - * @param isError The error flag. - * @param isPrivate The Private message - * @param color The color. - */ - @SuppressWarnings("unused") - public Message(final String message, - final boolean isNotice, - final boolean isError, - final boolean isPrivate, - final String color) { - msg = message; - this.isNotice = isNotice; - this.isError = isError; - this.isPrivate = isPrivate; - this.color = color; - } - - /** - * Returns the message color. - * - * @return The color. - */ - public String getColor() { - return color; - } - - /** - * Returns the message. - * - * @return The message. - */ - public String getMessage() { - return msg; - } - - /** - * Returns the message error flag. - * - * @return The error flag. - */ - public boolean isError() { - return isError; - } - - /** - * Returns the message notice flag. - * - * @return The notice flag. - */ - public boolean isNotice() { - return isNotice; - } - - /** - * Returns the message private flag. - * - * @return The private flag. - */ - public boolean isPrivate() { - return isPrivate; - } - - /** - * Set the color. - * - * @param color The new color. - */ - public void setColor(final String color) { - this.color = color; - } - - /** - * Sets the message error flag. - * - * @param error The error flag. - */ - public void setError(final boolean error) { - isError = error; - } - - /** - * Sets the message. - * - * @param message The new message. - */ - public void setMessage(final String message) { - msg = message; - } - - /** - * Sets the message notice flag. - * - * @param isNotice The notice flag. - */ - public void setNotice(final boolean isNotice) { - this.isNotice = isNotice; - } - - /** - * Sets the message private flag. - * - * @param isPrivate The private flag. - */ - @SuppressWarnings("unused") - public void setPrivate(final boolean isPrivate) { - this.isPrivate = isPrivate; - } - - @Override - public String toString() { - return "Message{" + "color='" + color + '\'' + ", isError=" + isError + ", isNotice=" + isNotice - + ", isPrivate=" + isPrivate + ", msg='" + msg + '\'' + '}'; - } -} diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/Message.kt b/src/main/java/net/thauvin/erik/mobibot/msg/Message.kt new file mode 100644 index 0000000..d95e792 --- /dev/null +++ b/src/main/java/net/thauvin/erik/mobibot/msg/Message.kt @@ -0,0 +1,105 @@ +/* + * Message.java + * + * Copyright (c) 2004-2020, Erik C. Thauvin (erik@thauvin.net) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of this project nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.thauvin.erik.mobibot.msg + +import org.jibble.pircbot.Colors + +/** + * The `Message` class. + * + * @author [Erik C. Thauvin](https://erik.thauvin.net/) + * @created 2019-04-07 + * @since 1.0 + */ +open class Message { + /** Color */ + var color = Colors.NORMAL + + /** Error */ + var isError = false + + /** Notice */ + var isNotice = false + + /** Private */ + var isPrivate = false + + /** Message text*/ + var text = "" + + /** Creates a new message. */ + constructor() { + // This constructor is intentionally empty + } + + /** + * Creates a new message. + * + * @param text The message. + * @param isNotice The notice flag. + * @param isError The error flag. + * @param isPrivate The Private message + */ + constructor(text: String, isNotice: Boolean, isError: Boolean, isPrivate: Boolean) { + this.text = text + this.isNotice = isNotice + this.isError = isError + this.isPrivate = isPrivate + } + + /** + * Creates a new message. + * + * @param text The message. + * @param isNotice The notice flag. + * @param isError The error flag. + * @param isPrivate The Private message + * @param color The color. + */ + constructor( + text: String, + isNotice: Boolean, + isError: Boolean, + isPrivate: Boolean, + color: String + ) { + this.text = text + this.isNotice = isNotice + this.isError = isError + this.isPrivate = isPrivate + this.color = color + } + + override fun toString(): String { + return "Message(color='$color', isError=$isError, isNotice=$isNotice, isPrivate=$isPrivate, message='$text')" + } +} diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.java b/src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.kt similarity index 73% rename from src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.java rename to src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.kt index 258d947..b7c0ad3 100644 --- a/src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.java +++ b/src/main/java/net/thauvin/erik/mobibot/msg/NoticeMessage.kt @@ -29,38 +29,35 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package net.thauvin.erik.mobibot.msg; +package net.thauvin.erik.mobibot.msg /** - * The NoticeMessage class. + * The `NoticeMessage` class. * - * @author Erik C. Thauvin + * @author [Erik C. Thauvin](https://erik.thauvin.net/) * @created 2019-04-07 * @since 1.0 */ -public class NoticeMessage extends Message { +class NoticeMessage : Message { /** * Creates a new notice. * - * @param message The notice's message. + * @param text The notice's message. */ - public NoticeMessage(final String message) { - super(); - this.setMessage(message); - this.setNotice(true); + constructor(text: String) : super() { + this.text = text + isNotice = true } /** * Create a new notice. * - * @param message The notice's message. - * @param color The color. + * @param text The notice's message. + * @param color The color. */ - public NoticeMessage(final String message, final String color) { - super(); - this.setMessage(message); - this.setNotice(true); - this.setColor(color); + constructor(text: String, color: String) : super() { + this.text = text + isNotice = true + this.color = color } } diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.java b/src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.kt similarity index 75% rename from src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.java rename to src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.kt index 1079a4d..4f9d4e9 100644 --- a/src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.java +++ b/src/main/java/net/thauvin/erik/mobibot/msg/PrivateMessage.kt @@ -29,32 +29,36 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package net.thauvin.erik.mobibot.msg; +package net.thauvin.erik.mobibot.msg /** - * The PrivateMessage class. + * The `PrivateMessage` class. * - * @author Erik C. Thauvin + * @author [Erik C. Thauvin](https://erik.thauvin.net/) * @created 2019-04-09 * @since 1.0 */ -@SuppressWarnings("unused") -public class PrivateMessage extends Message { - public PrivateMessage(final String message) { - super(); - this.setMessage(message); +@Suppress("unused") +class PrivateMessage : Message { + /** + * Creates a new private message. + * + * @param text The message. + */ + constructor(text: String) : super() { + this.text = text + isPrivate = true } /** * Creates a new private message. * - * @param message The message. - * @param color The message color. + * @param text The message. + * @param color The message color. */ - public PrivateMessage(final String message, final String color) { - super(); - this.setMessage(message); - this.setColor(color); + constructor(text: String, color: String) : super() { + this.text = text + this.color = color + isPrivate = true } } diff --git a/src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.java b/src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.kt similarity index 75% rename from src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.java rename to src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.kt index 3c4e924..2bd991b 100644 --- a/src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.java +++ b/src/main/java/net/thauvin/erik/mobibot/msg/PublicMessage.kt @@ -29,32 +29,34 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -package net.thauvin.erik.mobibot.msg; +package net.thauvin.erik.mobibot.msg /** - * The PublicMessage class. + * The `PublicMessage` class. * - * @author Erik C. Thauvin + * @author [Erik C. Thauvin](https://erik.thauvin.net/) * @created 2019-04-07 * @since 1.0 */ -public class PublicMessage extends Message { - public PublicMessage(final String message) { - super(); - this.setMessage(message); +class PublicMessage : Message { + /** + * Creates a new public message. + * + * @param text The message. + */ + constructor(text: String) : super() { + this.text = text } /** * Creates a new public message. * - * @param message The message. - * @param color The message color. + * @param text The message. + * @param color The message color. */ - @SuppressWarnings("unused") - public PublicMessage(final String message, final String color) { - super(); - this.setMessage(message); - this.setColor(color); + @Suppress("unused") + constructor(text: String, color: String) : super() { + this.text = text + this.color = color } } diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.java index 9291c4f..f72d74a 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/CurrencyConverterTest.java @@ -54,11 +54,11 @@ public class CurrencyConverterTest { @Test @SuppressFBWarnings("PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS") public void testConvertCurrency() { - assertThat(CurrencyConverter.convertCurrency("100 USD to EUR").getMessage()) + assertThat(CurrencyConverter.convertCurrency("100 USD to EUR").getText()) .as("100 USD to EUR").matches("100\\.00 USD = \\d{2,3}\\.\\d{2} EUR"); - assertThat(CurrencyConverter.convertCurrency("100 USD to USD").getMessage()) + assertThat(CurrencyConverter.convertCurrency("100 USD to USD").getText()) .as("100 USD to USD").contains("You're kidding, right?"); - assertThat(CurrencyConverter.convertCurrency("100 USD").getMessage()) + assertThat(CurrencyConverter.convertCurrency("100 USD").getText()) .as("100 USD").contains("Invalid query."); assertThat(CurrencyConverter.currencyRates().size()) .as("currencyRates().size() == 33").isEqualTo(33); diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/GoogleSearchTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/GoogleSearchTest.java index 13388bd..4b07647 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/GoogleSearchTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/GoogleSearchTest.java @@ -63,20 +63,20 @@ public class GoogleSearchTest extends LocalProperties { try { List messages = GoogleSearch.searchGoogle("mobibot site:github.com", apiKey, cseKey); assertThat(messages).as("mobibot results not empty").isNotEmpty(); - assertThat(messages.get(0).getMessage()).as("found mobitopia").contains("mobibot"); + assertThat(messages.get(0).getText()).as("found mobitopia").contains("mobibot"); messages = GoogleSearch.searchGoogle("aapl", apiKey, cseKey); assertThat(messages).as("aapl results not empty").isNotEmpty(); - assertThat(messages.get(0).getMessage()).as("found apple").containsIgnoringCase("apple"); + assertThat(messages.get(0).getText()).as("found apple").containsIgnoringCase("apple"); assertThatThrownBy(() -> GoogleSearch.searchGoogle("test", "", "apiKey")).as("no API key").isInstanceOf( - ModuleException.class).hasNoCause(); + ModuleException.class).hasNoCause(); assertThatThrownBy(() -> GoogleSearch.searchGoogle("test", "apiKey", "")).as("no CSE API key").isInstanceOf( - ModuleException.class).hasNoCause(); + ModuleException.class).hasNoCause(); assertThatThrownBy(() -> GoogleSearch.searchGoogle("", "apikey", "apiKey")).as("no query").isInstanceOf( - ModuleException.class).hasNoCause(); + ModuleException.class).hasNoCause(); } catch (ModuleException e) { // Avoid displaying api keys in CI logs if ("true".equals(System.getenv("CI"))) { diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/JokeTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/JokeTest.java index d62cd2e..93836e7 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/JokeTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/JokeTest.java @@ -51,7 +51,7 @@ public class JokeTest { @Test public void testRamdomJoke() throws ModuleException { - assertThat(Joke.randomJoke().getMessage().length() > 0).as("randomJoke() > 0").isTrue(); - assertThat(Joke.randomJoke().getMessage()).as("randomJoke()").containsIgnoringCase("chuck"); + assertThat(Joke.randomJoke().getText().length() > 0).as("randomJoke() > 0").isTrue(); + assertThat(Joke.randomJoke().getText()).as("randomJoke()").containsIgnoringCase("chuck"); } } diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/StockQuoteTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/StockQuoteTest.java index b3a4971..5931cd5 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/StockQuoteTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/StockQuoteTest.java @@ -58,7 +58,7 @@ public class StockQuoteTest extends LocalProperties { try { final List messages = StockQuote.getQuote("apple inc", apiKey); assertThat(messages).as("response not empty").isNotEmpty(); - assertThat(messages.get(0).getMessage()).as("same stock symbol").contains("AAPL").contains("Apple Inc."); + assertThat(messages.get(0).getText()).as("same stock symbol").contains("AAPL").contains("Apple Inc."); try { StockQuote.getQuote("012", apiKey); diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/TwitterTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/TwitterTest.java index cf64b4d..b1514a9 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/TwitterTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/TwitterTest.java @@ -74,6 +74,6 @@ public class TwitterTest { LocalProperties.getProperty(Twitter.TOKEN_SECRET_PROP), LocalProperties.getProperty(Constants.TWITTER_HANDLE_PROP), msg, - true).getMessage()).as("twitterPost(" + msg + ')').isEqualTo(msg); + true).getText()).as("twitterPost(" + msg + ')').isEqualTo(msg); } } diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/Weather2Test.java b/src/test/java/net/thauvin/erik/mobibot/modules/Weather2Test.java index f39c459..f22e049 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/Weather2Test.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/Weather2Test.java @@ -54,12 +54,12 @@ public class Weather2Test extends LocalProperties { @Test public void testWeather() throws ModuleException { List messages = Weather2.getWeather("98204", LocalProperties.getProperty(Weather2.OWM_API_KEY_PROP)); - assertThat(messages.get(0).getMessage()).as("is Everett").contains("Everett").contains("US"); - assertThat(messages.get(messages.size() - 1).getMessage()).as("is City Search").endsWith("98204%2CUS"); + assertThat(messages.get(0).getText()).as("is Everett").contains("Everett").contains("US"); + assertThat(messages.get(messages.size() - 1).getText()).as("is City Search").endsWith("98204%2CUS"); messages = Weather2.getWeather("London, UK", LocalProperties.getProperty(Weather2.OWM_API_KEY_PROP)); - assertThat(messages.get(0).getMessage()).as("is UK").contains("London").contains("UK"); - assertThat(messages.get(messages.size() - 1).getMessage()).as("is City Code").endsWith("4517009"); + assertThat(messages.get(0).getText()).as("is UK").contains("London").contains("UK"); + assertThat(messages.get(messages.size() - 1).getText()).as("is City Code").endsWith("4517009"); assertThatThrownBy( () -> Weather2.getWeather("Montpellier, FR", LocalProperties.getProperty(Weather2.OWM_API_KEY_PROP))).as( diff --git a/src/test/java/net/thauvin/erik/mobibot/modules/WordTimeTest.java b/src/test/java/net/thauvin/erik/mobibot/modules/WordTimeTest.java index 7f623ff..6d6e630 100644 --- a/src/test/java/net/thauvin/erik/mobibot/modules/WordTimeTest.java +++ b/src/test/java/net/thauvin/erik/mobibot/modules/WordTimeTest.java @@ -47,9 +47,9 @@ import static org.assertj.core.api.Assertions.assertThat; public class WordTimeTest { @Test public void testWorldTime() { - assertThat(WorldTime.worldTime("PST").getMessage()).as("PST").endsWith(Utils.bold("Los Angeles")); + assertThat(WorldTime.worldTime("PST").getText()).as("PST").endsWith(Utils.bold("Los Angeles")); assertThat(WorldTime.worldTime("BLAH").isError()).as("BLAH").isTrue(); - assertThat(WorldTime.worldTime("BEATS").getMessage()).as("BEATS").contains("@"); + assertThat(WorldTime.worldTime("BEATS").getText()).as("BEATS").contains("@"); } @Test