Exemplo n.º 1
0
  @Test
  public void extend_overrideField() throws Exception {
    field3.setName("field1"); // group2.field1 overrides group1.field1

    group1 = new GroupConfigImpl();
    group1.setName("group1");
    group1.setFieldConfigImplList(createFieldList(field1));
    group1.afterPropertiesSet();

    group2 = new GroupConfigImpl();
    group2.setName("group2");
    group2.setFieldConfigImplList(createFieldList(field2, field3));
    group2.setParentGroup("group1");
    group2.afterPropertiesSet();

    formConfig.setGroupConfigImplList(createGroupList(group1, group2));
    formConfig.afterPropertiesSet();

    assertEquals(1, group1.getFieldConfigList().size());
    assertSame(field1, group1.getFieldConfig("field1"));

    assertEquals(2, group2.getFieldConfigList().size());
    assertSame(field3, group2.getFieldConfig("field1"));
    assertSame(field2, group2.getFieldConfig("field2"));
  }
Exemplo n.º 2
0
  @Test
  public void getFieldConfig() throws Exception {
    // not init
    assertNull(group.getFieldConfig("test"));

    // init
    initForm(createFieldList(field1, field2, field3));

    // case insensitive
    assertSame(field1, group.getFieldConfig("FIELD1"));
    assertSame(field2, group.getFieldConfig("field2"));
    assertSame(field3, group.getFieldConfig("fiELD3"));
  }