}
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);
}
* {@inheritDoc}
*/
@Override
- public String text(String mimeType, int maxLength) {
+ public String text(String mimeType) {
return mimeTypeTexts.get(mimeType);
}
/**
* 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>
* @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);
}
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"))
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"))
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")))