/** Test delete smart point from tag. */
  @Test
  public void testDeleteLightFromTag() {
    // Validation situation
    TagRequest tagRequest = new TagRequest(new UserContext(1));
    Tag tag = new Tag();
    TagResponse response = getTagBCF().deleteLightFromTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(
        response,
        SENSUS_MLC_VALIDATOR_ID_REQUIRED,
        SENSUS_MLC_VALIDATOR_REQUIRED,
        SENSUS_MLC_VALIDATOR_ID_REQUIRED);

    // Success situation
    tagRequest = TestBaseUtil.createTagRequest();
    Light light = TestBaseUtil.createLight();
    List<Integer> lightIdsList = new ArrayList<Integer>();
    lightIdsList.add(1);
    tag.getLights().add(light);
    List<Tag> tagList = new ArrayList<Tag>();
    tagList.add(TestBaseUtil.createTag());
    tagRequest.setTags(tagList);
    tagRequest.setPaginationAllSelected(true);
    tagRequest.setSelectionPaginationIds(lightIdsList);
    response = getTagBCF().deleteLightFromTag(tagRequest);
    assertTrue(response.isOperationSuccess());

    // Exception situation
    resetMocksToTagArea();
    setSituation(getTagBCF(), SituationsEnum.EXCEPTION, ITagBCL.class, DELETE_LIGHT_FROM_TAG);
    response = getTagBCF().deleteLightFromTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(response, DEFAULT_TAG_BCF_EXCEPTION_MSG);

    // Error situation
    resetMocksToTagArea();
    setSituation(getTagBCF(), SituationsEnum.ERROR, ITagBCL.class, DELETE_LIGHT_FROM_TAG);
    response = getTagBCF().deleteLightFromTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(response, ERROR_CODE);

    // Error situation
    tagRequest = TestBaseUtil.createTagRequest();
    response = getTagBCF().deleteLightFromTag(tagRequest);
    assertFalse(response.isOperationSuccess());

    // Error situation
    tagRequest = TestBaseUtil.createTagRequest();
    tag = TestBaseUtil.createTag();
    tag.setId(null);
    lightIdsList = new ArrayList<Integer>();
    lightIdsList.add(1);
    tagRequest.setTag(tag);
    tagRequest.setPaginationAllSelected(true);
    tagRequest.setSelectionPaginationIds(lightIdsList);
    response = getTagBCF().deleteLightFromTag(tagRequest);
    assertFalse(response.isOperationSuccess());
  }
  /** Test update auto group tag. */
  @Test
  public void testUpdateAutoGroupTag() {
    // Validation situation
    TagRequest tagRequest = new TagRequest(new UserContext(1));
    Tag tag = new Tag();
    tagRequest.setTag(tag);
    TagResponse response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(
        response,
        SENSUS_MLC_VALIDATOR_ID_REQUIRED,
        SENSUS_MLC_VALIDATOR_REQUIRED,
        SENSUS_MLC_VALIDATOR_ID_REQUIRED);

    // Success situation
    tagRequest = TestBaseUtil.createTagRequest();
    tag = TestBaseUtil.createTag();
    tag.setAutoGroup(true);
    tagRequest.setTag(tag);
    tagRequest.setIncludeLightsToGroup(true);
    response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertTrue(response.isOperationSuccess());
    assertEquals(0, response.getMessageInfoList().size());

    // Error situation
    resetMocksToTagArea();
    setSituation(getTagBCF(), SituationsEnum.ERROR, ITagBCL.class, UPDATE_AUTO_GROUP_TAG);
    tagRequest = TestBaseUtil.createTagRequest();
    tag = TestBaseUtil.createTag();
    tag.setAutoGroup(true);
    tagRequest.setTag(tag);
    tagRequest.setIncludeLightsToGroup(true);
    response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(response, ERROR_CODE);

    // Error situation
    tagRequest = TestBaseUtil.createTagRequest();
    tag = TestBaseUtil.createTag();
    tag.setId(null);
    tagRequest.setTag(tag);
    tagRequest.setIncludeLightsToGroup(true);
    response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertFalse(response.isOperationSuccess());

    // Error situation
    tagRequest = TestBaseUtil.createTagRequest();
    response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertFalse(response.isOperationSuccess());

    // Exception situation
    resetMocksToTagArea();
    setSituation(getTagBCF(), SituationsEnum.EXCEPTION, ITagBCL.class, UPDATE_AUTO_GROUP_TAG);
    tagRequest = TestBaseUtil.createTagRequest();
    tag = TestBaseUtil.createTag();
    tag.setAutoGroup(true);
    tagRequest.setTag(tag);
    tagRequest.setIncludeLightsToGroup(true);
    response = getTagBCF().updateAutoGroupTag(tagRequest);
    assertFalse(response.isOperationSuccess());
    assertMessages(response, DEFAULT_TAG_BCF_EXCEPTION_MSG);
  }