@Test(expected = SamzaException.class)
  public void testGetMetadataExceptionAfterSuccessfulFetch() {
    SystemStreamPartition ssp = buildSSP(0);
    SSPMetadataCache cache = buildSSPMetadataCache(ImmutableSet.of(ssp));

    // do a successful fetch first
    when(clock.currentTimeMillis()).thenReturn(10L);
    when(systemAdmin.getSSPMetadata(ImmutableSet.of(ssp))).thenReturn(ImmutableMap.of(ssp, sspMetadata(1)));
    cache.getMetadata(ssp);

    // throw an exception on the next fetch
    when(clock.currentTimeMillis()).thenReturn(11 + CACHE_TTL.toMillis());
    when(systemAdmin.getSSPMetadata(ImmutableSet.of(ssp))).thenThrow(new SamzaException());
    cache.getMetadata(ssp);
  }
Given that the admin throws an exception when trying to get the metadata after a successful fetch, getMetadata
should propagate the exception.
samza-core/src/test/java/org/apache/samza/system/TestSSPMetadataCache.java