2 Replies Latest reply on May 6, 2008 4:56 PM by Edwin van der Elst

    TestNG & @In problems

    Edwin van der Elst Newbie

      I have problems getting the @In to work during testing.


      First some code:


      @Name("dummy")
      public class DummyBean {
         @In(value="user") String user; 
         public String test() {
            return "hello "+user ;
         }
      }



      Test code:


         @Test
         public void testAction() throws Exception {
            new ComponentTest() {
      
               @Override
               protected void testComponents() throws Exception {
                  setValue("#{user}", "x");
                  assert invokeMethod("#{dummy.test}").equals("hello x");
               }
               
            }.run();
         }
      



      I get the following error:


      javax.el.ELException: org.jboss.seam.RequiredException: @In attribute requires non-null value: dummy.user



      I tried with
      #{dummy.user}
      and dummy.user, but that also doesn't work.


      Has anyone got a clue how to inject a simple String value within a test?


      Cheers,


      Edwin