🔥 Remove unused parameter
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 21 Sep 2020 18:52:56 +0000 (20:52 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 21 Sep 2020 18:52:56 +0000 (20:52 +0200)
src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java
src/main/java/net/pterodactylus/rhynodge/output/DefaultOutput.java
src/main/java/net/pterodactylus/rhynodge/output/Output.java
src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt

index 4dfece0..e1441f3 100644 (file)
@@ -118,20 +118,20 @@ public class EmailAction implements Action {
        }
 
        private void addPlainTextPart(Output output, MimeMultipart multipart) throws MessagingException {
-               if (output.text("text/plain", -1) == null) {
+               if (output.text("text/plain") == null) {
                        return;
                }
                MimeBodyPart textPart = new MimeBodyPart();
-               textPart.setContent(output.text("text/plain", -1), "text/plain;charset=utf-8");
+               textPart.setContent(output.text("text/plain"), "text/plain;charset=utf-8");
                multipart.addBodyPart(textPart);
        }
 
        private void addHtmlPart(Output output, MimeMultipart multipart) throws MessagingException {
-               if (output.text("text/html", -1) == null) {
+               if (output.text("text/html") == null) {
                        return;
                }
                MimeBodyPart htmlPart = new MimeBodyPart();
-               htmlPart.setContent(output.text("text/html", -1), "text/html;charset=utf-8");
+               htmlPart.setContent(output.text("text/html"), "text/html;charset=utf-8");
                multipart.addBodyPart(htmlPart);
        }
 
index bf77aff..3426769 100644 (file)
@@ -78,7 +78,7 @@ public class DefaultOutput implements Output {
         * {@inheritDoc}
         */
        @Override
-       public String text(String mimeType, int maxLength) {
+       public String text(String mimeType) {
                return mimeTypeTexts.get(mimeType);
        }
 
index dc058bb..853c9ce 100644 (file)
@@ -21,7 +21,7 @@ import net.pterodactylus.rhynodge.Trigger;
 
 /**
  * Defines the output of a {@link Trigger}. As different output has to be
- * generated for different media, the {@link #text(String, int)} method takes as
+ * generated for different media, the {@link #text(String)} method takes as
  * an argument the MIME type of the desired output.
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
@@ -45,12 +45,9 @@ public interface Output {
         * @param mimeType
         *            The MIME type of the text (“text/plain” and “text/html” should
         *            be supported by all {@link Trigger}s)
-        * @param maxLength
-        *            The maximum length of the returned text (may be &lt; {@code 0}
-        *            to indicate no length restriction)
         * @return The text for the given MIME type, or {@code null} if there is no
         *         text defined for the given MIME type
         */
-       String text(String mimeType, int maxLength);
+       String text(String mimeType);
 
 }
index ee4b53b..ca140c0 100644 (file)
@@ -60,7 +60,7 @@ class WeatherTriggerTest {
         trigger.mergeStates(previousState, currentState)
         val reaction = mock(Reaction::class.java)
         val output = trigger.output(reaction)
-        val htmlText = output.text("text/html", -1)
+        val htmlText = output.text("text/html")
         File("/tmp/wetter.html").writer().use { it.write(htmlText) }
         assertThat(htmlText, containsString("00:00"))
         assertThat(htmlText, containsString("10 °C"))
@@ -94,7 +94,7 @@ class WeatherTriggerTest {
         trigger.mergeStates(previousState, currentState)
         val reaction = mock(Reaction::class.java)
         val output = trigger.output(reaction)
-        val htmlText = output.text("text/html", -1)
+        val htmlText = output.text("text/html")
         assertThat(htmlText, containsString("Time"))
         assertThat(htmlText, containsString("Temperature"))
         assertThat(htmlText, containsString("feels like"))
@@ -116,7 +116,7 @@ class WeatherTriggerTest {
         trigger.mergeStates(previousState, currentState)
         val reaction = mock(Reaction::class.java)
         val output = trigger.output(reaction)
-        val htmlText = output.text("text/html", -1)
+        val htmlText = output.text("text/html")
         assertThat(htmlText, containsString("Time"))
         assertThat(htmlText, containsString("Temperature"))
         assertThat(htmlText, not(containsString("feels like")))