ProfileStoreService { @SneakyThrows public void registerPrivate(UserID id, UserPrivateProfile profile) { log.debug("Register private {}", profile); try (OutputStream os = writeService.write( WithCallback.noCallback(access.withSystemAccess(dfsConfig.privateProfile(id)))) ) { os.write(serde.toJson(profile).getBytes()); } profileCache.getPrivateProfile().remove(id); } @Inject  ProfileStoreService(GsonSerde serde, UserProfileCache profileCache, DFSConfig dfsConfig,
                               BucketAccessService access, StorageWriteService writeService); @SneakyThrows void registerPrivate(UserID id, UserPrivateProfile profile); @SneakyThrows void registerPublic(UserID id, UserPublicProfile profile);  }
@Test @SneakyThrows void registerPrivate() { tested.registerPrivate(userID, profilePriv); verify(serde).toJson(profilePriv); verify(os).write(PROFILE_STR.getBytes()); verify(access).withSystemAccess(privateProfile); verify(profileCache).getPrivateProfile(); verify(cachePrivate).remove(userID); }