@Test public void testHandleNullItems_Other() { HasItemsAvailableValuesAspectDefinition hasItemsAvailableValuesAspectDefinition = new HasItemsAvailableValuesAspectDefinition( AvailableValuesType.DYNAMIC); Component component = mock(HasItems.class, withSettings().extraInterfaces(Component.class)); hasItemsAvailableValuesAspectDefinition.handleNullItems(new LabelComponentWrapper(component), new LinkedList<>(Arrays.asList(TestEnum.ONE, null))); verifyNoMoreInteractions(component); hasItemsAvailableValuesAspectDefinition.handleNullItems(new LabelComponentWrapper(component), new LinkedList<>(Arrays.asList(TestEnum.TWO))); verifyNoMoreInteractions(component); }
@SuppressWarnings("unchecked") @Override protected void handleNullItems(ComponentWrapper componentWrapper, List<?> items) { Object component = componentWrapper.getComponent(); if (component instanceof ComboBox<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((ComboBox<Object>)component).setEmptySelectionAllowed(hasNullItem); } else if (component instanceof NativeSelect<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((NativeSelect<Object>)component).setEmptySelectionAllowed(hasNullItem); } }
HasItemsAvailableValuesAspectDefinition extends AvailableValuesAspectDefinition<HasItems<?>> { @SuppressWarnings("unchecked") @Override protected void handleNullItems(ComponentWrapper componentWrapper, List<?> items) { Object component = componentWrapper.getComponent(); if (component instanceof ComboBox<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((ComboBox<Object>)component).setEmptySelectionAllowed(hasNullItem); } else if (component instanceof NativeSelect<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((NativeSelect<Object>)component).setEmptySelectionAllowed(hasNullItem); } } }
HasItemsAvailableValuesAspectDefinition extends AvailableValuesAspectDefinition<HasItems<?>> { @SuppressWarnings("unchecked") @Override protected void handleNullItems(ComponentWrapper componentWrapper, List<?> items) { Object component = componentWrapper.getComponent(); if (component instanceof ComboBox<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((ComboBox<Object>)component).setEmptySelectionAllowed(hasNullItem); } else if (component instanceof NativeSelect<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((NativeSelect<Object>)component).setEmptySelectionAllowed(hasNullItem); } } HasItemsAvailableValuesAspectDefinition(AvailableValuesType availableValuesType); }
HasItemsAvailableValuesAspectDefinition extends AvailableValuesAspectDefinition<HasItems<?>> { @SuppressWarnings("unchecked") @Override protected void handleNullItems(ComponentWrapper componentWrapper, List<?> items) { Object component = componentWrapper.getComponent(); if (component instanceof ComboBox<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((ComboBox<Object>)component).setEmptySelectionAllowed(hasNullItem); } else if (component instanceof NativeSelect<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((NativeSelect<Object>)component).setEmptySelectionAllowed(hasNullItem); } } HasItemsAvailableValuesAspectDefinition(AvailableValuesType availableValuesType);  }
HasItemsAvailableValuesAspectDefinition extends AvailableValuesAspectDefinition<HasItems<?>> { @SuppressWarnings("unchecked") @Override protected void handleNullItems(ComponentWrapper componentWrapper, List<?> items) { Object component = componentWrapper.getComponent(); if (component instanceof ComboBox<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((ComboBox<Object>)component).setEmptySelectionAllowed(hasNullItem); } else if (component instanceof NativeSelect<?>) { boolean hasNullItem = items.removeIf(i -> i == null); ((NativeSelect<Object>)component).setEmptySelectionAllowed(hasNullItem); } } HasItemsAvailableValuesAspectDefinition(AvailableValuesType availableValuesType);   }