コード例 #1
0
  @Test
  public void testBuilder() {
    final LayoutDescriptors layoutDescriptors =
        LayoutDescriptors.create()
            .add(
                LayoutDescriptor.create()
                    .name("fancy-layout")
                    .displayName("Fancy layout")
                    .config(Form.create().build())
                    .regions(RegionDescriptors.create().build())
                    .key(DescriptorKey.from("module:fancy-layout"))
                    .build())
            .add(
                LayoutDescriptor.create()
                    .name("fancy-layout2")
                    .displayName("Fancy layout2")
                    .config(Form.create().build())
                    .regions(RegionDescriptors.create().build())
                    .key(DescriptorKey.from("module:fancy-layout2"))
                    .build())
            .build();

    assertEquals(2, layoutDescriptors.getSize());
    assertNotNull(layoutDescriptors.getDescriptor("fancy-layout"));
    assertNotNull(layoutDescriptors.getDescriptor(DescriptorKey.from("module:fancy-layout2")));
  }