7 Replies Latest reply on Mar 13, 2007 2:06 PM by Charles Crouch

    Substituting ScopeType.APPLICATION components during testing

    Charles Crouch Expert

      Say you have a component in your app annotated like:
      @Name("productionInitializer")
      @Scope(ScopeType.APPLICATION)
      @Startup

      which sets up some stuff that you will need in production.

      Now assume you want to test your app using SeamTest and a FacesRequest say, but using a mock implementation of "productionInitializer". Is it possible from within your test to specify an alternative implementation for "productionInitializer"?

      If you were testing just a single POJO component then I guess you could just inject your mock implementation into the component e.g. pojo.setInitializer(mockInitializer), and start testing from there. But I don't know if its possible to do something similar within the more managed environment of SeamTest?

      Thanks