### Question:
StackDownscaleValidatorService { public void checkClusterInValidStatus(Cluster cluster) { if (cluster.getStatus() == Status.STOPPED) { throw new BadRequestException("Cluster is in Stopped status. Please start the cluster for downscale."); } }  void checkInstanceIsTheClusterManagerServerOrNot(String instancePublicIp, InstanceMetadataType metadataType); void checkUserHasRightToTerminateInstance(String owner, String userId, Long stackId); void checkClusterInValidStatus(Cluster cluster);  }### Answer:
@Test public void testCheckClusterInValidStatusWhenValidStatus() { Cluster cluster = new Cluster(); cluster.setStatus(Status.AVAILABLE); underTest.checkClusterInValidStatus(cluster); }
@Test public void testCheckClusterInValidStatusWhenInStoppedStatus() { Cluster cluster = new Cluster(); cluster.setStatus(Status.STOPPED); expectedException.expect(BadRequestException.class); expectedException.expectMessage("Cluster is in Stopped status. Please start the cluster for downscale."); underTest.checkClusterInValidStatus(cluster); }