CDSShardAccessImpl implements CDSShardAccess, LeaderLocationListener, AutoCloseable { @Override public DOMDataTreeIdentifier getShardIdentifier() { checkNotClosed(); return prefix; } CDSShardAccessImpl(final DOMDataTreeIdentifier prefix, final ActorUtils actorUtils); @Override DOMDataTreeIdentifier getShardIdentifier(); @Override LeaderLocation getLeaderLocation(); @Override CompletionStage<Void> makeLeaderLocal(); @Override LeaderLocationListenerRegistration<L> registerLeaderLocationListener(final L listener); @Override @SuppressWarnings("checkstyle:IllegalCatch") void onLeaderLocationChanged(final LeaderLocation location); @Override void close();  }
@Test @SuppressWarnings("checkstyle:IllegalCatch") public void testGetShardIdentifier() { assertEquals(shardAccess.getShardIdentifier(), TEST_ID); shardAccess.close(); try { shardAccess.getShardIdentifier(); fail("Exception expected"); } catch (final Exception e) { assertTrue(e instanceof IllegalStateException); } }