### Question:
IdentityUser extends IdentityPrincipal<IdentityUser> { @Override public ListenableFuture<Boolean> unmap(IdentityService service) throws IOException { logger.log(Level.FINE, "Unmapping user {0}", this); ListenableFuture<User> updateUserMapping = service.updateUserMapping(googleIdentity, schema, attribute, Optional.empty()); return Futures.transform( updateUserMapping, new Function<User, Boolean>() { @Override @Nullable public Boolean apply(@Nullable User input) { checkNotNull(input, "updated user can not be null"); checkArgument( isSameUser(googleIdentity, input), "unexpected user object. expected %s got %s", googleIdentity, input); return true; } }, getExecutor()); } private  IdentityUser(Builder builder); String getSchema(); String getAttribute(); String getGoogleIdentity(); @Override Kind getKind(); @Override ListenableFuture<IdentityUser> sync(
      @Nullable IdentityUser previouslySynced, IdentityService service); @Override ListenableFuture<Boolean> unmap(IdentityService service); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testUnmap() throws IOException, InterruptedException, ExecutionException { IdentityUser user = new IdentityUser.Builder() .setUserIdentity("user1") .setSchema("schema") .setAttribute("attrib") .setGoogleIdentity("user@domain.com") .build(); when(mockIdentityService.updateUserMapping( "user@domain.com", "schema", "attrib", Optional.empty())) .thenReturn(Futures.immediateFuture(new User().setPrimaryEmail("user@domain.com"))); ListenableFuture<Boolean> sync = user.unmap(mockIdentityService); assertTrue(sync.get()); }
@Test public void testUnmapFails() throws IOException, InterruptedException, ExecutionException { IdentityUser user = new IdentityUser.Builder() .setUserIdentity("user1") .setSchema("schema") .setAttribute("attrib") .setGoogleIdentity("user@domain.com") .build(); when(mockIdentityService.updateUserMapping( "user@domain.com", "schema", "attrib", Optional.empty())) .thenReturn(Futures.immediateFailedFuture(new IOException("unable to update user"))); ListenableFuture<Boolean> sync = user.unmap(mockIdentityService); thrown.expectCause(isA(IOException.class)); sync.get(); }