ParametrizedWidgetFactory { public WidgetContainer createWidgetContainer(ContractInput contractInput) { WidgetContainer container = new WidgetContainer(); if (contractInput.isMultiple()) { container.setRepeatedCollection(isParentMultiple(contractInput) ? multipleInputValue(contractInput) : singleInputValue(contractInput)); } return container; } ParametrizedWidgetFactory(); AbstractParametrizedWidget createParametrizedWidget(ContractInput input); boolean isSupported(ContractInput input); WidgetContainer createWidgetContainer(ContractInput contractInput); WidgetContainer createWidgetContainer(); TitleWidget createTitle(String title); TitleWidget createTitle(ContractInput input); ButtonWidget createSubmitButton(ButtonAction actionType); ButtonWidget createAddButton(ContractInput contractInput); ButtonWidget createRemoveButton(); LinkWidget createLink(String text, String url, ButtonStyle style); static final String ITEM_ITERATOR; }
@Test public void create_a_container_with_full_size() throws Exception { ParametrizedWidgetFactory elementFactory = createFactory(); ContractInput input = mock(ContractInput.class); when(input.isMultiple()).thenReturn(false); WidgetContainer container = elementFactory.createWidgetContainer(input); assertThat(container.getDimension()).isEqualTo(12); }
@Test public void create_a_displayed_container() throws Exception { ParametrizedWidgetFactory elementFactory = createFactory(); ContractInput input = mock(ContractInput.class); when(input.isMultiple()).thenReturn(false); WidgetContainer container = elementFactory.createWidgetContainer(input); AbstractParametrizedWidgetAssert.assertThat(container).isDisplayed(); }