### Question:
UmaTokenStore { public void deleteRPT(String id) throws NotFoundException, ServerException { try { readRPT(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 testDeleteRPT() throws Exception { final RequestingPartyToken rpt = new RequestingPartyToken(); rpt.setRealm("REALM"); when(cts.read("123")).thenReturn(RPT_TOKEN); when(rptAdapter.fromToken(RPT_TOKEN)).thenReturn(rpt); store.deleteRPT("123"); verify(cts).delete("123"); }
@Test(expectedExceptions = ServerException.class) public void testDeleteRPTFailure() throws Exception { final RequestingPartyToken rpt = new RequestingPartyToken(); rpt.setRealm("REALM"); when(cts.read("123")).thenReturn(RPT_TOKEN); doThrow(CoreTokenException.class).when(cts).delete("123"); when(rptAdapter.fromToken(RPT_TOKEN)).thenReturn(rpt); store.deleteRPT("123"); }
@Test(expectedExceptions = NotFoundException.class) public void testDeleteRPTMissing() throws Exception { when(cts.read("123")).thenThrow(CoreTokenException.class); store.deleteRPT("123"); }