@Test
  public void getLists() throws Exception {
    HubSpotListLists hsll = connector.getContactsLists(USER_ID, null, null);

    String listID = null;

    for (final HubSpotList hsl : hsll.getLists()) {
      if (hsl != null && !hsl.getDeleted()) {
        listID = hsl.getListId();
        break;
      }
    }

    if (listID == null) {
      throw new Exception(
          "It must be one List not deleted in the sandbox to complete the test case");
    }

    Assert.assertNotNull(hsll);
    Assert.assertTrue(hsll.getLists().size() >= 0);

    final HubSpotList hsl = connector.getContactListById(USER_ID, listID);

    Assert.assertNotNull(hsl);

    hsll = connector.getDynamicContactLists(USER_ID, null, null);

    Assert.assertNotNull(hsll);
    Assert.assertTrue(hsll.getLists().size() > 1);

    final ContactList cl = connector.getContactsInAList(USER_ID, listID, null, null, null);

    Assert.assertNotNull(cl);
  }
  @Test
  public void addAndRemoveContactFromLists()
      throws HubSpotConnectorException, HubSpotConnectorNoAccessTokenException,
          HubSpotConnectorAccessTokenExpiredException {
    // Create a new contact
    final String email = createNewContact();

    // Retrieve the contact by email and check that all the properties setted are stablished
    final Contact c = connector.getContactByEmail(USER_ID, email);
    Assert.assertNotNull(c);

    // Retrieve all the email lists and use one that is not dynamic
    final HubSpotListLists hsll = connector.getContactsLists(USER_ID, null, null);
    Assert.assertNotNull(hsll);

    for (final HubSpotList hbl : hsll.getLists()) {
      // It must be a non dynamic list
      if (!hbl.getDynamic()) {
        final String listId = hbl.getListId();

        final HubSpotListAddContactToListResponse hslactlr =
            connector.addExistingContactInAList(USER_ID, listId, c.getVid());

        Assert.assertNotNull(hslactlr);
        Assert.assertNotNull(hslactlr.getUpdated());
        Assert.assertEquals(1, hslactlr.getUpdated().size());
        Assert.assertEquals(Integer.valueOf(c.getVid()), hslactlr.getUpdated().get(0));

        break;
      }
    }

    // Delete the contact by his ID and check the response
    final ContactDeleted cd = connector.deleteContact(USER_ID, c.getVid());

    Assert.assertNotNull(cd);
    Assert.assertTrue(cd.getDeleted());
    Assert.assertEquals(cd.getVid(), c.getVid());
  }