]> git.basschouten.com Git - openhab-addons.git/commit
[mail] Fix unstable MailBuilderTest (#12471)
authorWouter Born <github@maindrain.net>
Sun, 13 Mar 2022 19:26:32 +0000 (20:26 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Mar 2022 19:26:32 +0000 (20:26 +0100)
commitcb1c1e586e32d831071592509dbb0ef77c8c6021
tree8f6e0d3db4ac000bcbf375881a6f909b725e9849
parent43fe75ba2e9e1d8413ceda4bac5311fedb21618b
[mail] Fix unstable MailBuilderTest (#12471)

When a URL attachment is used a check is done if an InputStream to the URL can be opened to see if it is valid.
Because the openHAB website was used the test would fail when the website has issues:

```
[ERROR]  org.openhab.binding.mail.MailBuilderTest.withURLAttachmentReturnsMultiPartEmail  Time elapsed: 10.391 s  <<< ERROR!
org.apache.commons.mail.EmailException: Invalid URL set:http://www.openhab.org
at org.openhab.binding.mail.MailBuilderTest.withURLAttachmentReturnsMultiPartEmail(MailBuilderTest.java:77)
Caused by: java.io.IOException: Server returned HTTP response code: 520 for URL: http://www.openhab.org
at org.openhab.binding.mail.MailBuilderTest.withURLAttachmentReturnsMultiPartEmail(MailBuilderTest.java:77)
```

It will now use a file URL instead so it is no longer depends on a website.

Signed-off-by: Wouter Born <github@maindrain.net>
bundles/org.openhab.binding.mail/src/test/java/org/openhab/binding/mail/MailBuilderTest.java
bundles/org.openhab.binding.mail/src/test/resources/attachment.txt [new file with mode: 0644]