ProfileStoreService { @SneakyThrows public void registerPublic(UserID id, UserPublicProfile profile) { log.debug("Register public {}", profile); try (OutputStream os = writeService.write( WithCallback.noCallback(access.withSystemAccess(dfsConfig.publicProfile(id)))) ) { os.write(serde.toJson(profile).getBytes()); } profileCache.getPublicProfile().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 registerPublic() { tested.registerPublic(userID, profilePub); verify(serde).toJson(profilePub); verify(os).write(PROFILE_STR.getBytes()); verify(access).withSystemAccess(publicProfile); verify(profileCache).getPublicProfile(); verify(cachePublic).remove(userID); }