public void testDecoratorInstanceIsDependentObject() throws Exception {
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
TextPage resp01 = webClient.getPage(contextPath + "bank?action=deposit&amount=10");
assertTrue(resp01.getContent().contains("ShortTermBalance:10"));
assertTrue(resp01.getContent().contains("DurableBalance:10"));
assertTrue(resp01.getContent().contains("PostConstructCallers:2"));
// Note that short-term account is request scoped and thus destroyed after request - however this info is not available
// during the request - we have to check after the next request
assertTrue(resp01.getContent().contains("PreDestroyCallers:0"));
TextPage resp02 = webClient.getPage(contextPath + "bank?action=deposit&amount=10");
assertTrue(resp02.getContent().contains("ShortTermBalance:10"));
assertTrue(resp02.getContent().contains("DurableBalance:20"));
assertTrue(resp02.getContent().contains("PostConstructCallers:3"));
assertTrue(resp02.getContent().contains("PreDestroyCallers:1"));
// And finally check decorator is applied
TextPage resp03 = webClient.getPage(contextPath + "bank?action=withdraw&amount=5");
assertTrue(resp03.getContent().contains("ShortTermBalance:-10"));
assertTrue(resp03.getContent().contains("DurableBalance:10"));
assertTrue(resp03.getContent().contains("PostConstructCallers:4"));
assertTrue(resp03.getContent().contains("PreDestroyCallers:2"));
}