### Question:
UmaTokenStore { public void deletePermissionTicket(String id) throws NotFoundException, ServerException { try { readPermissionTicket(id); cts.delete(id); } catch (CoreTokenException e) { throw new ServerException("Could not delete token: " + id); } } @Inject  UmaTokenStore(@Assisted String realm, JavaBeanAdapter<RequestingPartyToken> rptAdapter,
            JavaBeanAdapter<PermissionTicket> permissionTicketAdapter, CTSPersistentStore cts,
            UmaProviderSettingsFactory settingsFactory); RequestingPartyToken readRPT(String id); PermissionTicket readPermissionTicket(String id); UmaToken readToken(String ticketId, JavaBeanAdapter<? extends UmaToken> adapter); void deleteRPT(String id); void deletePermissionTicket(String id); void updatePermissionTicket(PermissionTicket permissionTicket);  }### Answer:
@Test public void testDeletePermissionTicket() throws Exception { final PermissionTicket ticket = new PermissionTicket("123", "abc", new HashSet<String>(asList("a")), null); ticket.setRealm("REALM"); when(cts.read("123")).thenReturn(TICKET_TOKEN); when(permissionTicketAdapter.fromToken(TICKET_TOKEN)).thenReturn(ticket); store.deletePermissionTicket("123"); verify(cts).delete("123"); }
@Test(expectedExceptions = NotFoundException.class) public void testDeletePermissionTicketMissing() throws Exception { when(cts.read("123")).thenThrow(CoreTokenException.class); store.deletePermissionTicket("123"); }
@Test(expectedExceptions = ServerException.class) public void testDeletePermissionTicketFailure() throws Exception { final PermissionTicket ticket = new PermissionTicket("123", "abc", new HashSet<String>(asList("a")), null); ticket.setRealm("REALM"); when(cts.read("123")).thenReturn(TICKET_TOKEN); when(permissionTicketAdapter.fromToken(TICKET_TOKEN)).thenReturn(ticket); doThrow(CoreTokenException.class).when(cts).delete("123"); store.deletePermissionTicket("123"); }