@Test
    public void shouldAddNewAccessListLoadBalancerWhenOperationSucceeds() throws Exception {
      List<AccessList> accessListsBefore =
          accessListService.getAccessListByAccountIdLoadBalancerId(
              loadBalancer.getAccountId(), loadBalancer.getId());

      LoadBalancer newLoadBalancer = new LoadBalancer();
      newLoadBalancer.setId(loadBalancer.getId());
      newLoadBalancer.setAccountId(loadBalancer.getAccountId());

      accessList.setLoadbalancer(loadBalancer);
      newLoadBalancer.addAccessList(accessList);

      accessListService.updateAccessList(newLoadBalancer);

      List<AccessList> accessListsAfter =
          accessListService.getAccessListByAccountIdLoadBalancerId(
              loadBalancer.getAccountId(), loadBalancer.getId());
      Assert.assertEquals(accessListsBefore.size() + 1, accessListsAfter.size());
    }
    @Test(expected = ImmutableEntityException.class)
    public void shouldThrowExceptionWhenLoaBalancerNotActive() throws Exception {
      loadBalancerService.setStatus(loadBalancer, LoadBalancerStatus.ERROR);

      LoadBalancer newLoadBalancer = new LoadBalancer();
      newLoadBalancer.setId(loadBalancer.getId());
      newLoadBalancer.setAccountId(loadBalancer.getAccountId());

      newLoadBalancer.addAccessList(accessList);

      accessListService.updateAccessList(newLoadBalancer);
    }
    @Test(expected = BadRequestException.class)
    public void shouldThrowExceptionWhenAccessListLimitExceeded() throws Exception {
      LoadBalancer newLoadBalancer = new LoadBalancer();
      newLoadBalancer.setId(loadBalancer.getId());
      newLoadBalancer.setAccountId(loadBalancer.getAccountId());

      accessList.setLoadbalancer(loadBalancer);
      for (int i = 0; i < 101; i++) {
        accessList = new AccessList();
        accessList.setIpAddress("new ip " + i);
        accessList.setType(AccessListType.ALLOW);
        newLoadBalancer.addAccessList(accessList);
      }

      accessListService.updateAccessList(newLoadBalancer);
    }
    @Test(expected = BadRequestException.class)
    public void shouldThrowExceptionWhenDuplicateAccessLists() throws Exception {
      LoadBalancer newLoadBalancer = new LoadBalancer();
      newLoadBalancer.setId(loadBalancer.getId());
      newLoadBalancer.setAccountId(loadBalancer.getAccountId());

      accessList.setLoadbalancer(loadBalancer);
      newLoadBalancer.addAccessList(accessList);

      accessListService.updateAccessList(newLoadBalancer);

      loadBalancerService.setStatus(loadBalancer, LoadBalancerStatus.ACTIVE);

      newLoadBalancer.addAccessList(accessList);
      accessListService.updateAccessList(newLoadBalancer);
    }