Does it allow to test the IOC side of JSF?

  3 posts   Feedicon  
Replies: 2 - Last Post: April 27, 2009 09:49
by: eddyd
showing 1 - 3 of 3
 
Posted: April 24, 2009 00:02 by eddyd
The code I need to unit test depends on JSF for messages and IOC. There are pieces like these:

FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null,
new FacesMessage("add entry failed - see log for details"));


FacesContext context = FacesContext.getCurrentInstance();
ELResolver elResolver = context.getApplication().getELResolver();
ELContext elContext = context.getELContext();
dbManager = (DBManagerResident) elResolver.getValue(
elContext, null, dbManagerResidentName);


Can I only set "facestester.webAppPath" and create "new FacesTester()" in JUnit setUp and then have the FacesContext properly set for the tests?

 
Posted: April 26, 2009 23:54 by rcoffin
Hi Eddyd,

I just verified that both of those snippets work as long as a FacesTester object has been instantiated once.

Cheers,

Rod
 
Posted: April 27, 2009 09:49 by eddyd
Thanks Rod.

Regards
Eddy
Replies: 2 - Last Post: April 27, 2009 09:49
by: eddyd
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close