@Test
  public void testGetException() throws Exception {
    // exception in primary should be thrown
    when(primarySource.get(any())).thenThrow(new RuntimeException());
    DataNodeConfig config = createConfig(1, 1);
    TestUtils.assertException(RuntimeException.class, () -> compositeSource.get(config.getInstanceName()), null);
    verify(primarySource).get(config.getInstanceName());
    verify(secondarySource, never()).get(any());

    // exception in secondary should be swallowed
    reset(primarySource, secondarySource);
    when(primarySource.get(any())).thenReturn(config);
    when(secondarySource.get(any())).thenThrow(new RuntimeException());
    assertEquals("Expected response from primary", config, compositeSource.get(config.getInstanceName()));
    verify(primarySource).get(config.getInstanceName());
    verify(secondarySource).get(config.getInstanceName());
    assertEquals("Expected one inconsistency", 1, metrics.getSwallowedErrorCount.getCount());
  }
Test exceptions thrown in the composite get method.
ambry-clustermap/src/test/java/com/github/ambry/clustermap/CompositeDataNodeConfigSourceTest.java