Пример #1
0
  public void testFilterToDescriptionsListWithBaseConditionAndFilter() throws Exception {
    try {
      // warehouse has a filter zoneNumber <= 999
      Warehouse.findByZoneNumberNumber(1000, 1);
    } catch (NoResultException ex) {
      fail("It needs a warehouse with zone number 1000");
    }

    setConditionValues(new String[] {"cuatrero"});
    execute("List.filter");
    execute("List.viewDetail", "row=0");

    assertLabelInCollection("deliveryPlaces", 3, "Name of Preferred warehouse");
    assertValueInCollection("deliveryPlaces", 0, 3, "CENTRAL VALENCIA");
    setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.2.]"});
    // execute("List.filter", "collection=deliveryPlaces"); // Not needed because
    // filterOnChange=true
    assertCollectionRowCount("deliveryPlaces", 0);
    setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.1.]"});
    // execute("List.filter", "collection=deliveryPlaces"); // Not needed because
    // filterOnChange=true
    assertCollectionNotEmpty("deliveryPlaces");

    try {
      setConditionValues("deliveryPlaces", new String[] {"", "", "", "[.1.1000.]"});
    } catch (IllegalArgumentException ex) {
      assertTrue(ex.getMessage().equals("No option found with value: [.1.1000.]"));
    }
  }