0 Replies Latest reply on Jul 18, 2012 12:16 PM by raphael_lacerda

    Integration Test with Seam 2.2 - Cannot Create component with Page Scope

    raphael_lacerda

      Simple test....

       

      @Name("myComponent")

      @Scope(ScopeType.EVENT)

      class MyComponent{

       

      }

       

       

      class MyComponentTest extends SeamTest

       

      @Test

      public void initialTest(){

           new ComponentTest() {

       

                  @Override

                                    protected void testComponents()

                                              throws Exception

                                    {

       

                                              MyComponent instance = (MyComponent) Component.getInstance(MyComponent.class, true);

       

                                              assertNotNull(instance);

                          

                                    }

                          }.run();

      }

       

      The test pass without any problem!

       

      Now, if i change the component scope to PAGE, the test fails. Seam cannot create this component anymore.

       

      Does anybody know why this is happening?

       

       

       

      @Name("myComponent")

      @Scope(ScopeType.PAGE)

      class MyComponent{

       

      }

       

      //Test fails =/ Component.getInstance(MyComponent.class, true) returns null