diff --git a/bundles/org.openhab.binding.mail/src/test/java/org/openhab/binding/mail/MailBuilderTest.java b/bundles/org.openhab.binding.mail/src/test/java/org/openhab/binding/mail/MailBuilderTest.java index 1f5d31d06..7d7dfda4d 100644 --- a/bundles/org.openhab.binding.mail/src/test/java/org/openhab/binding/mail/MailBuilderTest.java +++ b/bundles/org.openhab.binding.mail/src/test/java/org/openhab/binding/mail/MailBuilderTest.java @@ -18,6 +18,7 @@ import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; import java.net.MalformedURLException; +import java.nio.file.Path; import java.util.Map; import javax.mail.MessagingException; @@ -74,7 +75,8 @@ public class MailBuilderTest { public void withURLAttachmentReturnsMultiPartEmail() throws AddressException, EmailException, MalformedURLException { MailBuilder builder = new MailBuilder(TEST_EMAIL); - Email mail = builder.withText("boo").withURLAttachment("http://www.openhab.org").build(); + String url = Path.of("src/test/resources/attachment.txt").toUri().toURL().toString(); + Email mail = builder.withText("boo").withURLAttachment(url).build(); assertThat(mail, instanceOf(MultiPartEmail.class)); } diff --git a/bundles/org.openhab.binding.mail/src/test/resources/attachment.txt b/bundles/org.openhab.binding.mail/src/test/resources/attachment.txt new file mode 100644 index 000000000..dafe6b116 --- /dev/null +++ b/bundles/org.openhab.binding.mail/src/test/resources/attachment.txt @@ -0,0 +1 @@ +Lorem ipsum dolor sit amet, ut sed dolores repudiandae, no sit inani euripidis.