Пример #1
0
  public void testDataProvidedListChanged() throws Exception {
    DataProviderMetadata dataMeta =
        (DataProviderMetadata)
            form.getFormMetadata()
                .getDataProviderMetadatas()
                .get(new MethodEntry(form.getMethod("someDataProvider")));

    MockAbstractBinder binder =
        new MockAbstractBinder(root, form, handler) {
          protected void resetSelectedFields(DataProviderMetadata meta) throws Exception {
            put("resetSelectedFields(DataProviderMetadata)", meta);
          }
        };

    binder.bind();
    MockBoundDataProvider bound =
        (MockBoundDataProvider) binder.getBoundDataProvider(dataMeta.getWidgetName());

    final List list = Collections.singletonList("someValue");

    binder.dataProvidedListChanged(dataMeta, list);

    assertSame(list, bound.get("updateList(List)"));

    form.getController().setResetOnDataProviderChange(false);
    binder.clear();
    bound.clear();

    binder.dataProvidedListChanged(dataMeta, list);

    assertSame(list, bound.get("updateList(List)"));
    assertNull(binder.get("resetSelectedFields(DataProviderMetadata)"));
  }
Пример #2
0
  public void testDataProvidedIndexesChanged() throws Exception {
    DataProviderMetadata dataMeta =
        (DataProviderMetadata)
            form.getFormMetadata()
                .getDataProviderMetadatas()
                .get(new MethodEntry(form.getMethod("someDataProvider")));

    MockAbstractBinder binder = new MockAbstractBinder(root, form, handler);

    binder.bind();

    MockBoundDataProvider bound =
        (MockBoundDataProvider) binder.getBoundDataProvider(dataMeta.getWidgetName());

    final int[] indexes = new int[] {2, 5, 10};

    binder.dataProvidedIndexesChanged(dataMeta, indexes);

    assertSame(indexes, bound.get("updateIndexes(int[])"));
  }