Java Reference
In-Depth Information
Note
Note that the @Before annotation is invoked before each test method and
after injections have occurred. In our case, it is used to associate conversa-
tionContext with MutableBoundRequest before being activated by con-
versationContext.activate . This is needed to mimic the conversation be-
havior from within the Arquillian test bed.
Just for completeness, you must be aware that BoundRequest interfaces are
defined into the weld API to hold a conversation that spans multiple requests,
but are shorter than a session.
So here's the full TicketTest class that also contains the Theatre creation and a
booking seat reservation in the testTicketAgency method:
@RunWith(Arquillian.class)
public class TicketTest {
@Inject BoundConversationContext
conversationContext;
@Before
public void init() {
conversationContext.associate(
new MutableBoundRequest(new
HashMap<String, Object>(),
new HashMap<String, Object>()));
conversationContext.activate();
}
@Deployment
public static Archive<?> createTestArchive() {
return ShrinkWrap.create(WebArchive.class,
"ticket.war")
.addPackage(SeatProducer.class.getPackage())
Search WWH ::




Custom Search