[jboss-user] [JBoss Seam] - How to pass parameters with ComponentTest.invokeMethod

chawax do-not-reply at jboss.com
Wed Jan 16 05:15:24 EST 2008


Hi,

I write integration tests with EJB3 embedded container and I need to test a method needing parameters. I did it this way :

@org.testng.annotations.Test
  | public void testEmploye() throws Exception {
  |     new ComponentTest() {
  |         protected void testComponents() throws Exception
  | 	{
  |             Employe employe = new Employe();
  | 	    employe.setMatricule("000001");
  |             employe.setNom("nom");
  |             employe.setPrenom("prenom");
  |             employe = (Employe) invokeMethod("#{coreServiceEmploye.saveEmploye(employe)}");
  | 
  |             assert employe.getId() != null;
  |         }
  |     }.run();
  | }

But the "employe" parameter is not passed to coreServiceEmploye.saveEmploye method (it has a null value). I found only examples with setValue() to pass datas to components, but I could not find anything about how to pass parameters in a method on forums or anywhere. How should I do this ?

Thanks in advance

Olivier

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120354#4120354

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120354



More information about the jboss-user mailing list