hi,
i'm trying to test <secured> element in flows like this:
when i try to test it with my mouse and my favorite browser, it works fine.Code:<secured attributes="ROLE_ADMIN" />
but i want to test it with unit tests.
when i try the code below:
the code compile but no exception is raisedCode:@Test public void shouldNotAccessToProtectedFlow(){ //given AccessDeniedException accessDeniedException = null; login("user1", "melbourne");//grant authority is "ROLE_USER" //when try{ //expected grant authority is ROLE_ADMIN MutableAttributeMap input = new LocalAttributeMap(); MockExternalContext context = new MockExternalContext(); //setCurrentState("enterSearchCriteria"); startFlow(input, context); assertCurrentStateEquals("enterSearchCriteria"); }catch(AccessDeniedException a){ accessDeniedException = a; } //then assertNotNull("Access to protected flows is not protected, accessDeniedException should be null", accessDeniedException); }
the test failed because i thinck the <secured> element is not readen or understood (maybe no listener available?)
so what is the way to test it?


Reply With Quote
