### Question:
AllowlistPersistor { public synchronized void updateConfig( final ALLOWLIST_TYPE allowlistType, final Collection<String> updatedAllowlistValues) throws IOException { removeExistingConfigItem(allowlistType); addNewConfigItem(allowlistType, updatedAllowlistValues); } AllowlistPersistor(final String configurationFile); static boolean verifyConfigFileMatchesState(
      final ALLOWLIST_TYPE allowlistType,
      final Collection<String> checkLists,
      final Path configurationFilePath); boolean verifyConfigFileMatchesState(
      final ALLOWLIST_TYPE allowlistType, final Collection<String> checkLists); synchronized void updateConfig(
      final ALLOWLIST_TYPE allowlistType, final Collection<String> updatedAllowlistValues); @VisibleForTesting static void addNewConfigItem(
      final ALLOWLIST_TYPE allowlistType,
      final Collection<String> allowlistValues,
      final Path configFilePath);  }### Answer:
@Test public void lineShouldBeReplaced() throws IOException { ALLOWLIST_TYPE key = ALLOWLIST_TYPE.NODES; String newValue = "node5"; assertThat(countLines()).isEqualTo(2); assertThat(hasKeyAndExactLineContent(key, nodesAllowlist)).isTrue(); allowlistPersistor.updateConfig(key, Collections.singleton(newValue)); assertThat(countLines()).isEqualTo(2); assertThat(hasKeyAndContainsValue(key, newValue)).isTrue(); assertThat(hasKeyAndExactLineContent(key, nodesAllowlist)).isFalse(); }
@Test public void outputIsValidTOML() throws IOException { ALLOWLIST_TYPE key = ALLOWLIST_TYPE.ACCOUNTS; List<String> newValue = Lists.newArrayList("account5", "account6", "account4"); String expectedValue = String.format("%s=[%s]", "accounts-allowlist", "\"account5\",\"account6\",\"account4\""); allowlistPersistor.updateConfig(key, newValue); assertThat(hasKey(key)).isTrue(); assertThat(hasKeyAndExactLineContent(key, expectedValue)).isTrue(); }