コード例 #1
0
 @Test
 public void should_associate_container_property_values_with_its_id() throws Exception {
   assertThat(
           propertyValuesVisitor.visit(
               aContainer()
                   .withReference("container-id")
                   .withPropertyValue("foo", "bar", "baz")
                   .build()))
       .containsExactly(entry("container-id", singletonMap("foo", propertyValue)));
 }
コード例 #2
0
  @Test
  public void should_associate_component_property_values_contained_in_a_previewable_with_its_id()
      throws Exception {

    assertThat(
            propertyValuesVisitor.visit(
                aPage()
                    .with(
                        aComponent()
                            .withReference("component-id")
                            .withPropertyValue("foo", "bar", "baz"))
                    .build()))
        .containsExactly(entry("component-id", singletonMap("foo", propertyValue)));
  }
コード例 #3
0
  @Test
  public void should_generate_a_service_containing_parameter_values() throws Exception {
    HashMap<String, PropertyValue> propertyValues = new HashMap<>();
    PropertyValue propertyValue = new PropertyValue();
    propertyValue.setType("bar");
    propertyValue.setValue("baz");
    propertyValues.put("foo", propertyValue);

    Component component = aComponent().withPropertyValue("foo", "bar", "baz").build();
    Page page = aPage().with(component).build();

    assertThat(propertyValuesVisitor.generate(page))
        .isEqualTo(
            new TemplateEngine("factory.hbs.js")
                .with("name", "propertyValues")
                .with("resources", singletonMap(component.getReference(), propertyValues))
                .build(this));
  }
コード例 #4
0
 @Test
 public void should_associate_component_parameter_values_contained_in_a_formcontainer_with_its_id()
     throws Exception {
   assertThat(
           propertyValuesVisitor.visit(
               aFormContainer()
                   .with(
                       aContainer()
                           .with(
                               aComponent()
                                   .withReference("component-id")
                                   .withPropertyValue("foo", "bar", "baz"))
                           .withReference("container-id")
                           .build())
                   .withReference("formcontainer-id")
                   .build()))
       .containsOnly(
           entry("formcontainer-id", emptyMap()),
           entry("container-id", emptyMap()),
           entry("component-id", singletonMap("foo", propertyValue)));
 }