maven - Mock FacesContext to test my faces message displayer class -
my backing bean:
@managedbean(name = "messagedisplayer") @viewscoped public class messagedisplayer implements serializable { private final logger logger = loggerfactory.getlogger(this.getclass()); public void showmessage (facesmessage.severity severity, string summary, string detail) { facescontext context = facescontext.getcurrentinstance(); logger.debug("showing message severity='{}', summary='{}', detail='{}'", severity, summary, detail); context.addmessage(null, new facesmessage(severity, summary, detail)); } }
any help on how can utilize moclito test class!?
you should utilize powermock mock static methods. here illustration of how utilize it: https://code.google.com/p/powermock/wiki/mockstatic
maven jsf junit mockito facescontext
No comments:
Post a Comment