@Test
  public void testRouterPartitionsUnavailable() throws Exception {
    try {
      setRouter();
      setOperationParams();
      mockClusterMap.markAllPartitionsUnavailable();
      try {
        router.putBlob(putBlobProperties, putUserMetadata, putChannel, new PutBlobOptionsBuilder().build()).get();
        Assert.fail("Put should have failed if there are no partitions");
      } catch (Exception e) {
        RouterException r = (RouterException) e.getCause();
        Assert.assertEquals("Should have received AmbryUnavailable error", RouterErrorCode.AmbryUnavailable,
            r.getErrorCode());
      }
    } finally {
      if (router != null) {
        router.close();
        assertExpectedThreadCounts(0, 0);
        assertClosed();
      }
    }
  }
Test router put operation in a scenario where there are no partitions available.
ambry-router/src/test/java/com/github/ambry/router/NonBlockingRouterTest.java