@Test(expected = BadRequestException.class)
    public void shouldVerifySharedVipLbs() throws Exception {

      List<LoadBalancer> lbs = new ArrayList<LoadBalancer>();
      LoadBalancer loadBalancer = new LoadBalancer();
      loadBalancer.setId(3333);
      loadBalancer.setAccountId(55555);

      Set<LoadBalancerJoinVip> jvips = new HashSet<LoadBalancerJoinVip>();
      LoadBalancerJoinVip jvip = new LoadBalancerJoinVip();

      jvip.setVirtualIp(new VirtualIp());
      jvip.setId(new LoadBalancerJoinVip.Id(loadBalancer.getId(), 676));
      jvip.setLoadBalancer(lb);
      jvips.add(jvip);
      loadBalancer.setLoadBalancerJoinVipSet(jvips);

      List<LoadBalancer> sharedlbs = new ArrayList<LoadBalancer>();
      LoadBalancer sharedlb = new LoadBalancer();
      sharedlb.setId(9844);
      sharedlbs.add(sharedlb);
      when(virtualIpRepository.getLoadBalancersByVipId(Matchers.anyInt())).thenReturn(sharedlbs);

      lbs.add(loadBalancer);

      when(lbRepository.getById(Matchers.anyInt())).thenReturn(loadBalancer);
      List<LoadBalancer> newLbs;
      newLbs = lbService.reassignLoadBalancerHost(lbs);

      LoadBalancer newLb;
      newLb = newLbs.get(0);

      Assert.assertEquals((Object) 55555, newLb.getAccountId());
    }
    @Before
    public void standUp() throws EntityNotFoundException, UnprocessableEntityException {
      lb = new LoadBalancer();
      lbRepository = mock(LoadBalancerRepository.class);
      lbService = new LoadBalancerServiceImpl();
      lbService.setLoadBalancerRepository(lbRepository);

      SslTermination sslTermination = new SslTermination();
      sslTermination.setIntermediateCertificate("iCert");
      sslTermination.setCertificate("cert");
      sslTermination.setPrivatekey("aKey");
      sslTermination.setEnabled(true);
      sslTermination.setSecurePort(445);
      sslTermination.setSecureTrafficOnly(false);

      lb.setSslTermination(sslTermination);
      lb.setStatus(LoadBalancerStatus.ACTIVE);

      defaultProtocol =
          new LoadBalancerProtocolObject(LoadBalancerProtocol.HTTP, "HTTP Protocol", 80, true);
      when(lbRepository.getByIdAndAccountId(Matchers.<Integer>any(), Matchers.<Integer>any()))
          .thenReturn(lb);
      //            when(lbRepository.testAndSetStatus(Matchers.<Integer>any(),
      // Matchers.<Integer>any(),Matchers.<LoadBalancerStatus>any(),
      // Matchers.<Boolean>any())).thenReturn(true);

    }
    @Before
    public void standUp() {
      lb = new LoadBalancer();
      lbRepository = mock(LoadBalancerRepository.class);
      lbService = new LoadBalancerServiceImpl();
      lbService.setLoadBalancerRepository(lbRepository);

      defaultProtocol =
          new LoadBalancerProtocolObject(LoadBalancerProtocol.HTTP, "HTTP Protocol", 80, true);
      when(lbRepository.getDefaultProtocol()).thenReturn(defaultProtocol);
    }
    @Test
    @Ignore
    public void shouldReturnTrueWhenOverLoadBalancerLimit() throws EntityNotFoundException {
      //            LoadBalancerLimitGroup lbLimitGroup = new LoadBalancerLimitGroup();
      //            lbLimitGroup.setLimit(100);
      Integer numNonDeletedLoadBalancers = 9999;

      //
      // when(lbLimitRepository.getByAccountId(Matchers.<Integer>any())).thenReturn(lbLimitGroup);
      when(lbRepository.getNumNonDeletedLoadBalancersForAccount(Matchers.<Integer>any()))
          .thenReturn(numNonDeletedLoadBalancers);

      Assert.assertTrue(lbService.isLoadBalancerLimitReached(accountId));
    }
    @Test(expected = BadRequestException.class)
    public void shouldFailIfLbisSticky() throws Exception {
      when(lbRepository.getById(Matchers.<Integer>any())).thenReturn(lb);

      List<LoadBalancer> lbs = new ArrayList<LoadBalancer>();
      LoadBalancer loadBalancer = new LoadBalancer();
      loadBalancer.setId(3333);
      lb.setSticky(true);
      lbs.add(loadBalancer);

      List<LoadBalancer> newLbs;
      newLbs = lbService.reassignLoadBalancerHost(lbs);

      LoadBalancer newLb;
      newLb = newLbs.get(0);

      Assert.assertEquals((Object) 555555, newLb.getAccountId());
    }