@Override
   public HealthStatus getStatus() {
      if (cr.getStatus() == ComponentStatus.INITIALIZING) return HealthStatus.INITIALIZING;

      PartitionHandlingManager partitionHandlingManager = cr.getComponent(PartitionHandlingManager.class);
      if (!isComponentHealthy() || partitionHandlingManager.getAvailabilityMode() == AvailabilityMode.DEGRADED_MODE) {
         return HealthStatus.DEGRADED;
      }
      DistributionManager distributionManager = cr.getDistributionManager();
      if (distributionManager != null && distributionManager.isRehashInProgress()) {
         return HealthStatus.HEALTHY_REBALANCING;
      }
      return HealthStatus.HEALTHY;
   }
@Test
    public void testUnhealthyStatusWithStoppingComponent() {
        //given
        ComponentRegistry componentRegistryMock = mock(ComponentRegistry.class);

        doReturn(ComponentStatus.STOPPING).when(componentRegistryMock).getStatus();

        CacheHealth cacheHealth = new CacheHealthImpl(componentRegistryMock);

        //when
        HealthStatus status = cacheHealth.getStatus();

        //then
        assertEquals(status, HealthStatus.DEGRADED);
    }