[jboss-user] [JBoss Seam] - How to invoking methods with parameters with Seam test?

paradigmza do-not-reply at jboss.com
Tue Nov 20 05:42:27 EST 2007


Hi, I have looked through the seam examples can can't find out how to invoke a method with parameters with Seam test.

This is the method I want to test
@Stateless
  | @Name("dbi")
  | @AutoCreate
  | public class DBI_EJB_Impl implements DBI {
  | 
  | 	@In
  | 	EntityManager entityManager;
  | 	
  | 	
  | 	public void create(DataObject daoObject){
  | 		entityManager.persist(daoObject);
  | 	} ..

Now how do I actually call the create method and pass it the DataObject?

This is what I have so far
public class DBI_EJB_ImplTest extends DBUnitSeamTest {
  | 
  | 	public DBI_EJB_ImplTest() {
  | 		super("java:/SomeDatasource");
  | 	}
  | 
  | @Test
  | 	public void testCreate() throws Exception {
  | 		new ComponentTest() {
  | 			@Override
  | 			protected void testComponents() throws Exception {
  | 				Employee employee = new Employee();
  | 				employee.setFirstName("abcdefghijklmnop");
  | 				employee.setLastName("burns");
  | 				
  | 				//invokeMethod("#{dbi.create()}");
  | 				//How do I call this the method and pass in the employee?
  | 			}
  | 
  | 		}.run();
  | 
  | 

I am sure the solution is simple... I just can't find it.

Thanks.

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

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



More information about the jboss-user mailing list