Dirk Nimerem
unread,Dec 26, 2012, 3:15:12 PM12/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google...@googlegroups.com
Hi,
Let's say i have a class which represents an user, called "User" and an
interface implemented by this class called "IUser". The IUser interface
declares one method called "sendMail(String text)" for the user. Also i
created an interceptor/ aspect via the Guice bindInterceptor method for
my IUser. The aspect simply logs every call for the sendMail() method, that works fine.
1.) But how do i test, that my aspect works properly? I don't have an idea how to write an unit test for that. My idea was to create an IUser mock and trigger the public sendMail() method from outside. But how do I create an aspect on top of a mock?
2.) In my aspect/ interceptor i simply check the methodname like this: "if methodname == 'sendMail'". But if i rename/ refactor the sendMail Method my aspect won't work anymore. Is there a better way to to that?
Thanks,
Dirk