### Question:
WarpAutenticationManager { public void removeUser(String userName) throws CommunicationException { try { WebResource webResource = createRequestResource( "users/" + userName); webResource.delete(); } catch (UniformInterfaceException t) { throw new CommunicationException( "Exception when executing DELETE user: " + userName, t); } } WarpAutenticationManager(
            Client jerseyClient, String warpServerAddr, String warpAdminUser,
            String warpAdminPassword); AuthIdentity getUser(String userName); void removeUser(String userName); void createUser(AuthIdentity warpUserCredentials); void updateUser(
            String currentUserName,
            AuthIdentity newUserCredentials);  }### Answer:
@Test public void testRemoveUser() throws Exception { context.checking( new Expectations() { { oneOf(client).removeAllFilters(); oneOf(client).addFilter( with(equal(new BasicAuthFilter("admin", "lamepass")))); oneOf(client).resource( new URI("http: will(returnValue(resource)); oneOf(resource).accept(MediaType.APPLICATION_JSON_TYPE); oneOf(resource).delete(); } }); warpAutenticationManager.removeUser("joe"); context.assertIsSatisfied(); }
@Test public void testRemoveUserError() throws Exception { context.checking( new Expectations() { { oneOf(client).removeAllFilters(); oneOf(client).addFilter( with(equal(new BasicAuthFilter("admin", "lamepass")))); oneOf(client).resource( new URI("http: will(returnValue(resource)); oneOf(resource).accept(MediaType.APPLICATION_JSON_TYPE); oneOf(resource).delete(); will(throwException(expectedException)); } }); try { warpAutenticationManager.removeUser("joe"); fail("Expected an exception here"); } catch (WarpAutenticationManager.CommunicationException e) { } context.assertIsSatisfied(); }