#JavaMailSender Unit Tests

1 messages · Page 1 of 1 (latest)

frank notchBOT
#

<@&1004656351647117403> please have a look, thanks.

frank notchBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

inner escarp
#

it'll be very difficult to mock the correct parts, I'd suggest not testing this at all or add a return type to your method with a result

steel sparrow
#

or send to self and check if it recieves

inner escarp
wicked harbor
#

@hasty ember do you have the place where you make the JavaMailSender handy?

#

its just an interface

#

so hypothetically you can make an implementation that doesn't do anything

#

and then construct your class with that implementation

#

two ways to do that

#
  1. Just make it
#
class FakeMessageSender implements EmailSender {
    @Override
    public MimeMessage createMimeMessage() {
        // ...
    }

    // ...

    // and so on
}
#
  1. Use a library which can make a proxy for you like mockito
#

1 is probably what I would do with

#

at least for this interface