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

chawax do-not-reply at jboss.com
Thu Jan 17 05:47:09 EST 2008


I gave up using reflection to call Seam component and used getInstance() method instead to get the Seam component and then call its methods as usual. So now it looks like this :

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

It looks more simple to me, but are there things that will not work testing this way ? What is the interest of using invokeMethod() then ?

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

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



More information about the jboss-user mailing list