@Test
  public void testSerializationAndDeserialization() throws IOException {
    // Since the account metadata is stored in an map from string to string, so here we only test map<string, string>
    Collection<Account> state = new ArrayList<>();
    ByteBuffer buffer = BackupFileManager.serializeAccounts(state);
    Collection<Account> deserializedState = BackupFileManager.deserializeAccounts(buffer.array());
    assertEquals(state, deserializedState);

    // Put a real account's json string
    state.add(refAccount);
    buffer = BackupFileManager.serializeAccounts(state);
    deserializedState = BackupFileManager.deserializeAccounts(buffer.array());
    assertEquals(state, deserializedState);
  }
Test serialization and deserialization of {@link Account} metadata.
@throws JSONException if {@link Account} can't convert to json
ambry-account/src/test/java/com/github/ambry/account/BackupFileManagerTest.java