コード例 #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
  @Before
  public void init() throws Exception {
    formConfig = new FormConfigImpl();

    field1 = new FieldConfigImpl();
    field1.setName("fiELd1");

    field2 = new FieldConfigImpl();
    field2.setName("field2");

    field3 = new FieldConfigImpl();
    field3.setName("FIELD3");

    field4 = new FieldConfigImpl();
    field4.setName("field4");

    group = new GroupConfigImpl();
    group.setName("group1");

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

    group2 = new GroupConfigImpl();
    group2.setName("group2");
    group2.setFieldConfigImplList(createFieldList(field2));

    group3 = new GroupConfigImpl();
    group3.setName("group3");
    group3.setFieldConfigImplList(createFieldList(field3));

    group4 = new GroupConfigImpl();
    group4.setName("group4");
    group4.setFieldConfigImplList(createFieldList(field4));
  }
コード例 #3
0
ファイル: GroupConfigTests.java プロジェクト: GavinHwa/citrus
  private void import_dupFields(boolean importAll) throws Exception {
    init();

    List<Import> imports;
    field3.setName("field1"); // group2.field1 duped with 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));

    if (importAll) {
      imports = createImportList(new ImportImpl("group1", null));
    } else {
      imports = createImportList(new ImportImpl("group1", "field1"));
    }

    group2.setImports(imports);
    group2.afterPropertiesSet();

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

    try {
      formConfig.afterPropertiesSet();
      fail();
    } catch (IllegalArgumentException e) {
      assertThat(e, exception("Duplicated field name: \"group2.field1\""));
    }
  }
コード例 #4
0
ファイル: GroupConfigTests.java プロジェクト: GavinHwa/citrus
  private void initForm(List<FieldConfigImpl> fieldList) throws Exception {
    group.setFieldConfigImplList(fieldList);
    group.afterPropertiesSet();

    formConfig.setGroupConfigImplList(createGroupList(group));
    formConfig.afterPropertiesSet();
  }