コード例 #1
0
ファイル: GroupConfigTests.java プロジェクト: GavinHwa/citrus
  @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"));
  }
コード例 #2
0
ファイル: GroupConfigTests.java プロジェクト: GavinHwa/citrus
  @Test
  public void getParentGroup() {
    // no key
    assertNull(group.getParentGroup());

    // empty key
    group.setParentGroup("");
    assertNull(group.getParentGroup());

    group.setParentGroup("  ");
    assertNull(group.getParentGroup());

    // normal key
    group.setParentGroup("  hello ");
    assertEquals("hello", group.getParentGroup());
  }
コード例 #3
0
ファイル: GroupConfigTests.java プロジェクト: GavinHwa/citrus
  private void assertPostOnly(Boolean parentValue, Boolean overrideValue, boolean expectedValue)
      throws Exception {
    init();

    if (parentValue != null) {
      group1.setPostOnly(parentValue);
    }

    group1.afterPropertiesSet();

    if (overrideValue != null) {
      group2.setPostOnly(overrideValue);
    }

    group2.setParentGroup("group1");
    group2.afterPropertiesSet();

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

    assertEquals(expectedValue, group2.isPostOnly());
  }