Seam integration testing using TestNg
-------------------------------------
Key: JBSEAM-3416
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3416
Project: Seam
Issue Type: Task
Components: Seam Text
Affects Versions: 2.0.2.GA
Environment: JBOSS 4.3 server with TestNG plugin on eclipse 3.2
Reporter: Amit Purohit
Fix For: 2.0.2.GA
Thanks for the reply.
I could test most of my services using the examples provided in the Seam documentation.
However, I have a requirement, wherein my database services would accept a movie object
and persist it as shown below
public void persistMovieObj(Movie movie) {
try{
log.debug("Persisting movie information for the movie : " + movie.getTitle()
);
entityManager.persist(movie);
}catch(Exception e){
log.error("Unhandled exception was caught while persisting movie : " +
movie.getTitle() );
}
}
my test method is as shown below:
@Test
public void testPersistMovie() throws Exception{
new FacesRequest() {
@Override
protected void invokeApplication()
{
boolean pass = true;
try{
Movie movie =(Movie)Component.getInstance(Movie.class, create);
movie.setTitle("Movie1");
invokeMethod("#{S_Movie_Service.persistMovieObj(movie)}");
}catch(Exception e){
log.error("Error occured " + e.getMessage());
e.printStackTrace();
pass = false;
}finally{
assert pass;
}
}
}.run();
}
The above method doest not seem to pass the movie object to the services layer and hence I
get a null movie object when I try to persist the movie
Can you please tell me what I am doing wrong or the changes to be made in the code ?
Help Really Appreciated
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira