@Test public void testAuthorizePositive() throws Exception { final String perspectiveId = "perspectiveId"; final ArgumentCaptor<ResourceRef> resourceRefArgumentCaptor = ArgumentCaptor.forClass(ResourceRef.class); doReturn(true).when(authorizationManager).authorize(any(ResourceRef.class), eq(user)); assertTrue(shortcutHelper.authorize(perspectiveId)); verify(authorizationManager).authorize(resourceRefArgumentCaptor.capture(), eq(user)); assertEquals(perspectiveId, resourceRefArgumentCaptor.getValue().getIdentifier()); assertEquals(ActivityResourceType.PERSPECTIVE, resourceRefArgumentCaptor.getValue().getResourceType()); }
public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); }
ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } }
ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject  ShortcutHelper(final AuthorizationManager authorizationManager,
                          final User user,
                          final PlaceManager placeManager); }
ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject  ShortcutHelper(final AuthorizationManager authorizationManager,
                          final User user,
                          final PlaceManager placeManager); String getPart(final String text,
                          final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut); }
ShortcutHelper { public boolean authorize(final String perspective) { return authorizationManager.authorize(new ResourceRef(perspective, PERSPECTIVE), user); } ShortcutHelper(); @Inject  ShortcutHelper(final AuthorizationManager authorizationManager,
                          final User user,
                          final PlaceManager placeManager); String getPart(final String text,
                          final int part); void goTo(final String perspectiveIdentifier); boolean authorize(final String perspective); boolean authorize(final HomeShortcut shortcut);  }