Created
November 26, 2012 13:28
-
-
Save mkouba/4148202 to your computer and use it in GitHub Desktop.
WELD-1247
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WarpTest | |
@Category(Integration.class) | |
@RunWith(Arquillian.class) | |
public class Weld1247Test { | |
@Deployment | |
public static WebArchive deployment() { | |
return ShrinkWrap.create(WebArchive.class, "test.war") | |
.addClass(Bean.class) | |
.addAsWebResource(Weld1247Test.class.getPackage(), "index.xhtml", "index.xhtml") | |
.addAsWebInfResource(Weld1247Test.class.getPackage(), "web.xml", "web.xml") | |
.addAsWebInfResource(Weld1247Test.class.getPackage(), "faces-config.xml", "faces-config.xml") | |
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | |
} | |
@Test | |
@RunAsClient | |
public void testPreRenderViewExecutedExactlyOnce(@ArquillianResource URL url) throws Exception { | |
final WebClient client = new WebClient(); | |
Warp.execute(new ClientAction() { | |
@Override | |
public void action() { | |
try { | |
client.getPage(url + "/index.faces"); | |
} catch (Exception e) { | |
fail(e.getMessage()); | |
} | |
} | |
}).verify(new BeanInvocationAssertion()); | |
} | |
public static class BeanInvocationAssertion extends ServerAssertion { | |
private static final long serialVersionUID = 1L; | |
@AfterServlet | |
public void testInvocationCount() { | |
assertEquals(1, Bean.invocationCount); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment