hi stephen, if your alternative-instance/behavior should be different for "every" test and you can't use a mock-manager, you need to use a producer (for the original bean) and @Specializes it in the test-classpath. in your test you change the state of the test-producer with static methods (e.g. set a flag or a whole instance which should be returned by the test-producer). -> it's std. cdi and/or java - no special concept is needed.
if you would like to use alternative-bean-x1 (instead of bean-x) in test1 and alternative-bean-x2 (instead of bean-x) in test2, you can use labeled alternatives (provided by ds > v1.8.1) - see e.g. [1] and [2]. it's based on the new AlternativeBeanClassProvider spi (which you could use as well to implement your own concepts) - see e.g. [3]. regards, gerhard [1] https://github.com/apache/deltaspike/tree/master/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc014 [2] https://github.com/apache/deltaspike/tree/master/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc015 [3] https://github.com/apache/deltaspike/tree/master/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/uc016 http://www.irian.at Your JavaEE powerhouse - JavaEE Consulting, Development and Courses in English and German Professional Support for Apache MyFaces, DeltaSpike and OpenWebBeans 2018-04-14 15:24 GMT+02:00 Stephen More <[email protected]>: > I have a need to run some unit tests with @Alternative - mockedVersionA > and other tests with @Alternative - mockedVersionB > and other tests with @Alternative - mockedVersionC > > It looks like Arquillian can handle this utilizing ShrinkWrap and > @Deployment.... > addAsManifestResource( "mockedVersionA.xml","beans.xml"); > addAsManifestResource( "mockedVersionB.xml","beans.xml"); > > Can I achieve the same functionality using CdiTestRunner ? > -Thanks >
