### Question:
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);  }### Answer:
@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()); }
@Test public void testAuthorizeNegative() throws Exception { final String perspectiveId = "perspectiveId"; doReturn(false).when(authorizationManager).authorize(any(ResourceRef.class), eq(user)); assertFalse(shortcutHelper.authorize(perspectiveId)); }