use of com.amazonaws.services.elasticloadbalancingv2.model.TargetGroupAssociationLimitException in project titus-control-plane by Netflix.
the class AwsLoadBalancerConnectorTest method validateExceptionsAreUnmodifiedWithMockClientTest.
@Test
public void validateExceptionsAreUnmodifiedWithMockClientTest() {
Class defaultExceptionClass = TargetGroupAssociationLimitException.class;
TestSubscriber testSubscriber = new TestSubscriber();
AmazonElasticLoadBalancingAsync albClient = mock(AmazonElasticLoadBalancingAsync.class);
when(albClient.describeTargetHealthAsync(any(), any())).thenThrow(defaultExceptionClass);
awsLoadBalancerConnector = getAwsLoadBalancerConnector(albClient);
awsLoadBalancerConnector.getLoadBalancer(targetGroupWithTargets).subscribe(testSubscriber);
testSubscriber.awaitTerminalEvent();
List<Throwable> errors = testSubscriber.getOnErrorEvents();
assertEquals(1, errors.size());
Throwable throwable = errors.get(0);
assertFalse(throwable instanceof LoadBalancerException);
assertTrue(throwable instanceof TargetGroupAssociationLimitException);
}
Aggregations