telekom / testerra

Testerra is an integrated framework for automating tests for (web) applications.
https://docs.testerra.io/
Apache License 2.0
27 stars 15 forks source link

NullPointerException in Email using ImapMailConnector #371

Closed TobiasAdler closed 11 months ago

TobiasAdler commented 11 months ago

Describe the bug During the usage of the imap mail connector a null pointer exception is thrown when using an EmailQuery object to search for an email.

To Reproduce Steps to reproduce the behavior:

  1. Use an ImapMailConnector
  2. Send & recieve an email
  3. Create an EmailQuery object and set a search term
  4. Create an Optional of Email and use findFirst() using the query
  5. Inside the method readMessageContents() in Email a null pointer exception is thrown in line 166 while accessing the Part object

Expected behavior An Email object should be created and an Optional should be returned.

Actual behavior A null pointer exception is thrown.

Test

EmailQuery query = new EmailQuery().setSearchTerm(new AndTerm(new SubjectTerm("test form"), new BodyTerm(currentDate)));
Optional<Email> foundEmailOptional = imap.query(query).findFirst();

Environment