* @throws Exception
*/
@Test
public void testConversationScopeInjection() throws Exception {
Assert.assertNotNull(tester);
DummySeamApplication application = (DummySeamApplication) tester.getApplication();
application.setManuallyDetach(true);
// initialize conversation object values
conversationObjectProducer.add("First conversation message");
conversationObjectProducer.add("Second conversation message");
conversationObjectProducer.add("This message is not retrived");
// test first request in first conversation
tester.startPage(ConversationTestPage.class);
tester.assertRenderedPage(ConversationTestPage.class);
tester.assertResultPage(ConversationTestPage.class, "ConversationTestPageExpected.html");
// always detach request after all tests on current page
application.detach();
// test second request in first conversation
tester.clickLink("refresh");
tester.assertRenderedPage(ConversationTestPage.class);
// without manually detaching the conversation scope is closed to early.
tester.assertLabel("headerLabel", "First conversation message");
tester.assertLabel("spanLabel", "First conversation message");
tester.assertLabel("refresh:number", "1");
// always detach request after all tests on current page
application.detach();
// test first request in second conversation
tester.startPage(ConversationTestPage.class);
tester.assertRenderedPage(ConversationTestPage.class);
tester.assertLabel("headerLabel", "Second conversation message");
tester.assertLabel("spanLabel", "Second conversation message");
tester.assertLabel("refresh:number", "0");
// always detach request after all tests on current page
application.detach();
// test second request in second conversation
tester.clickLink("refresh");
tester.assertRenderedPage(ConversationTestPage.class);
tester.assertLabel("headerLabel", "Second conversation message");
tester.assertLabel("spanLabel", "Second conversation message");
tester.assertLabel("refresh:number", "1");
// always detach request after all tests on current page
application.detach();
}