Not sure I understand the question. Why wouldn't it work?
Managed/Remote/Embedded containers are the 'same' in that respect. We still deploy to the container and run the test in side the container. All of them have access to CDI.
You might be mixing this with RunMode, where if you RunAsClient you won't have access to CDI because it exists in the Container only.
Because according to the guy in the video said that:"Managed container run on different JVM with the test.". I can't picture how we consumed the Java EE resource outside the container. Is that true if I said the test method without @RunAsClient is run outside the container?
1 of 1 people found this helpful
"The guy in the video" is me..
And correct, ManagedContainers run in a different JVM then from where the test is launched, but.. the actual execution of the Test it self is 'forwarded' to this new JVM and are still executed incontainer with full access to the services provided by the container.
Technically when JUnit is launched from e.g. IDE the @Test method is overridden, invokes a Sevlet that is deployed in the container which again 'restarts the Test and executes the @Test method in side the new JVM and container. Then return the result back to the IDE as if it were executed in the same JVM.
I have to say "Wow". It's too complicated. Thank you Aslak