/** Test can insert custom search. */
  @Test
  public void testCanInsertCustomSearch() {
    // Can Insert
    List<MessageInfo> list = new ArrayList<MessageInfo>();

    CustomSearchRequest request = TestBaseUtil.createCustomSearchRequest();
    request.setCustomSearch(TestBaseUtil.createCustomSearch());
    Boolean canInsert =
        getSmartPointAccessorBCL()
            .fetchCanInsertCustomSearch(
                TestBaseUtil.createTenant(), TestBaseUtil.createCustomSearch(), 1, list, null);
    assertEquals("Can Insert", canInsert, true);

    resetMocksToSmartPointArea();

    // Can Not Insert
    setSituation(
        getSmartPointAccessorBCL(),
        SituationsEnum.ERROR,
        ISmartPointDAC.class,
        "fetchCanInsertCustomSearch");
    canInsert =
        getSmartPointAccessorBCL()
            .fetchCanInsertCustomSearch(
                TestBaseUtil.createTenant(), TestBaseUtil.createCustomSearch(), 1, list, null);
    assertEquals("Can Not Insert", canInsert, false);
  }
  /** Test fetch all lights by custom search. */
  @Test
  public void testFetchAllLightsByCustomSearch() {
    // Success situation
    CustomSearch customSearch = new CustomSearch();
    customSearch.setName("name1");
    customSearch.setDescription("description1");

    SearchParameter param = new SearchParameter();
    param.setPropertyEnum(PropertyEnum.GROUP_ID);
    param.setValue("5");

    customSearch.getSearchParameters().add(param);

    CustomSearchRequest request = TestBaseUtil.createCustomSearchRequest();
    request.setCustomSearch(customSearch);

    InternalResultsResponse<CustomSearch> response =
        getSmartPointUpdaterBCL().insertCustomSearch(request);
    assertResultResponse(response);

    InquiryLightRequest inquiryLightRequest =
        TestBaseUtil.createInquiryLightRequest(TestBaseUtil.createUserContext());
    inquiryLightRequest.setSearch(response.getFirstResult());

    InternalResultsResponse<Light> lightResponse =
        getSmartPointAccessorBCL().fetchAllLights(inquiryLightRequest);
    assertResultResponse(lightResponse);
  }