From bc384cab6e0242753c4e74252529d5cfd9c6d982 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 21 Sep 2020 20:52:56 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=94=A5=20Remove=20unused=20parameter?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java | 8 ++++---- .../java/net/pterodactylus/rhynodge/output/DefaultOutput.java | 2 +- src/main/java/net/pterodactylus/rhynodge/output/Output.java | 7 ++----- .../pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java b/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java index 4dfece0..e1441f3 100644 --- a/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java +++ b/src/main/java/net/pterodactylus/rhynodge/actions/EmailAction.java @@ -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); } diff --git a/src/main/java/net/pterodactylus/rhynodge/output/DefaultOutput.java b/src/main/java/net/pterodactylus/rhynodge/output/DefaultOutput.java index bf77aff..3426769 100644 --- a/src/main/java/net/pterodactylus/rhynodge/output/DefaultOutput.java +++ b/src/main/java/net/pterodactylus/rhynodge/output/DefaultOutput.java @@ -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); } diff --git a/src/main/java/net/pterodactylus/rhynodge/output/Output.java b/src/main/java/net/pterodactylus/rhynodge/output/Output.java index dc058bb..853c9ce 100644 --- a/src/main/java/net/pterodactylus/rhynodge/output/Output.java +++ b/src/main/java/net/pterodactylus/rhynodge/output/Output.java @@ -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 David ‘Bombe’ Roden @@ -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 < {@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); } diff --git a/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt b/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt index ee4b53b..ca140c0 100644 --- a/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt +++ b/src/test/kotlin/net/pterodactylus/rhynodge/webpages/weather/WeatherTriggerTest.kt @@ -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"))) -- 2.7.4