### Question:
MainnetPrecompiledContractRegistries { static void appendPrivacy( final PrecompileContractRegistry registry, final PrecompiledContractConfiguration precompiledContractConfiguration, final int accountVersion) { if (!precompiledContractConfiguration.getPrivacyParameters().isEnabled()) { return; } if (precompiledContractConfiguration.getPrivacyParameters().isOnchainPrivacyGroupsEnabled()) { registry.put( Address.ONCHAIN_PRIVACY, accountVersion, new OnChainPrivacyPrecompiledContract( precompiledContractConfiguration.getGasCalculator(), precompiledContractConfiguration.getPrivacyParameters())); } else { registry.put( Address.DEFAULT_PRIVACY, accountVersion, new PrivacyPrecompiledContract( precompiledContractConfiguration.getGasCalculator(), precompiledContractConfiguration.getPrivacyParameters(), "Privacy")); } } private  MainnetPrecompiledContractRegistries(); static PrecompileContractRegistry frontier(
      final PrecompiledContractConfiguration precompiledContractConfiguration); static PrecompileContractRegistry byzantium(
      final PrecompiledContractConfiguration precompiledContractConfiguration); static PrecompileContractRegistry istanbul(
      final PrecompiledContractConfiguration precompiledContractConfiguration); static PrecompileContractRegistry berlin(
      final PrecompiledContractConfiguration precompiledContractConfiguration);  }### Answer:
@Test public void whenOnchainPrivacyGroupsNotEnabled_defaultPrivacyPrecompileIsInRegistry() { when(privacyParameters.isOnchainPrivacyGroupsEnabled()).thenReturn(false); when(privacyParameters.isEnabled()).thenReturn(true); appendPrivacy(reg, config, Account.DEFAULT_VERSION); verify(privacyParameters).isEnabled(); verify(privacyParameters).isOnchainPrivacyGroupsEnabled(); assertThat(reg.get(Address.DEFAULT_PRIVACY, Account.DEFAULT_VERSION)) .isInstanceOf(PrivacyPrecompiledContract.class); assertThat(reg.get(Address.ONCHAIN_PRIVACY, Account.DEFAULT_VERSION)).isNull(); }
@Test public void whenOnchainPrivacyGroupsEnabled_onchainPrivacyPrecompileIsInRegistry() { when(privacyParameters.isOnchainPrivacyGroupsEnabled()).thenReturn(true); when(privacyParameters.isEnabled()).thenReturn(true); appendPrivacy(reg, config, Account.DEFAULT_VERSION); verify(privacyParameters).isEnabled(); verify(privacyParameters).isOnchainPrivacyGroupsEnabled(); assertThat(reg.get(Address.ONCHAIN_PRIVACY, Account.DEFAULT_VERSION)) .isInstanceOf(OnChainPrivacyPrecompiledContract.class); assertThat(reg.get(Address.DEFAULT_PRIVACY, Account.DEFAULT_VERSION)).isNull(); }
@Test public void whenPrivacyNotEnabled_noPrivacyPrecompileInRegistry() { when(privacyParameters.isEnabled()).thenReturn(false); appendPrivacy(reg, config, Account.DEFAULT_VERSION); verify(privacyParameters).isEnabled(); verifyNoMoreInteractions(privacyParameters); assertThat(reg.get(Address.ONCHAIN_PRIVACY, Account.DEFAULT_VERSION)).isNull(); assertThat(reg.get(Address.DEFAULT_PRIVACY, Account.DEFAULT_VERSION)).isNull(); }