Search the web
Sign In
New User? Sign Up
junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
how to load faces-managed-beans.xml from JUnit Test cases   Message List  
Reply | Forward Message #21112 of 22044 |
Re: how to load faces-managed-beans.xml from JUnit Test cases

Actually my code goes like this.......


public class UserBean extends BaseBean {

public String loginAction() {
try {
User user = this.serviceLocator.getUserService().login
(this.username.trim(), this.password.trim());
catch (Exception e) {
}
}
}
-------------------------------------------------


public class BaseBean {
//the logger for this class
protected final Log logger = LogFactory.getLog(this.getClass());

//the service locator of the business services
protected ServiceLocator serviceLocator;

public BaseBean() {
}

public ServiceLocator getServiceLocator() {
return this.serviceLocator;
}

public void setServiceLocator(ServiceLocator
newServiceLocator) {
this.logger.debug("service locator is set");
this.serviceLocator = newServiceLocator;

this.init();
}


--------------------------------------------------------------------

public interface ServiceLocator {

/**
* Get the <code>UserService</code>.
*
* @return the user service
*/
public UserService getUserService();


}


Thanks..




Tue Nov 18, 2008 1:28 pm

novin_b
Offline Offline
Send Email Send Email

Forward
Message #21112 of 22044 |
Expand Messages Author Sort by Date

Hi I'm doing project in Icefaces with spring and hibernate. For that i m writing junit test. i wrote test cases for DAO as well as services classes. I have...
novin_b
Offline Send Email
Nov 14, 2008
7:53 am

Novin_b, ... There's a lot of dereferences in this line which could throw a NullPointerException. Have you initialized the serviceLocator field? David Saff...
David Saff
dsaff
Offline Send Email
Nov 17, 2008
7:12 pm

Actually my code goes like this....... public class UserBean extends BaseBean { public String loginAction() { try { User user =...
novin_b
Offline Send Email
Nov 18, 2008
1:28 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help