Closed GoogleCodeExporter closed 9 years ago
There is no reason for Wiser not to return the internal representation; it
allows your unit tests to manipulate it as you wish. Need a copy? Make one.
Original comment by lhori...@gmail.com
on 24 Dec 2010 at 9:23
OK. But in order to safely make a copy we would need to subclass Wiser and
override the messages property. The code we have that currently blows up with
ConcurrentModificationException is nothing out of the ordinary:
List<MimeMessage> retVal = new ArrayList<MimeMessage>();
List<WiserMessage> wiserMessages = wiser.getMessages();
if (wiserMessages != null) {
for (WiserMessage wiserMessage : wiserMessages) {
retVal.add(wiserMessage.getMimeMessage());
}
}
return retVal;
Original comment by s_etheri...@hotmail.com
on 24 Dec 2010 at 11:18
Wiser really wasn't intended to be hit from multiple threads - it's really just
a very simple testing tool for junit-style tests. If you want something more
robust, the code for Wiser is almost trivial - and now you can extend it and
replace the structure used to store messages.
It's tempting to simply replace the ArrayList with a CopyOnWriteList but I am
hesitant to change the performance profile of a tool that some people very
possibly use to test thousands of deliveries.
Original comment by lhori...@gmail.com
on 24 Dec 2010 at 6:18
Original issue reported on code.google.com by
s_etheri...@hotmail.com
on 19 Dec 2010 at 10:35