@Test public void testIsCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot() { Assert.assertFalse(PlotViewPolicy.isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(leafWithAFeedComponent)); Assert.assertFalse(PlotViewPolicy.isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(leafWithOutAFeedComponent)); List<AbstractComponent> childComponents = new ArrayList<AbstractComponent>(); childComponents.add(leafWithAFeedComponent); childComponents.add(leafWithOutAFeedComponent); Mockito.when(compoundComponent.getComponents()).thenReturn(childComponents); Assert.assertTrue(PlotViewPolicy.isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(compoundComponent)); Assert.assertFalse(PlotViewPolicy.isCompoundComponentWithCompoundChildrenThatRequirePlots(compoundComponent)); childComponents.remove(leafWithAFeedComponent); Assert.assertFalse(PlotViewPolicy.isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(compoundComponent)); Assert.assertFalse(PlotViewPolicy.isCompoundComponentWithCompoundChildrenThatRequirePlots(compoundComponent)); }
static boolean isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(AbstractComponent component) { if (component.isLeaf()) { return false; } for (AbstractComponent childComponent : component.getComponents()) { if (hasFeed(childComponent)) { return true; } } return false; }
PlotViewPolicy implements Policy { static boolean isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(AbstractComponent component) { if (component.isLeaf()) { return false; } for (AbstractComponent childComponent : component.getComponents()) { if (hasFeed(childComponent)) { return true; } } return false; } }
PlotViewPolicy implements Policy { static boolean isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(AbstractComponent component) { if (component.isLeaf()) { return false; } for (AbstractComponent childComponent : component.getComponents()) { if (hasFeed(childComponent)) { return true; } } return false; }  }
PlotViewPolicy implements Policy { static boolean isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(AbstractComponent component) { if (component.isLeaf()) { return false; } for (AbstractComponent childComponent : component.getComponents()) { if (hasFeed(childComponent)) { return true; } } return false; }  @Override ExecutionResult execute(PolicyContext context); static AbstractComponent[][] getPlotComponents(AbstractComponent targetComponent, boolean ordinalPosition); static boolean isScatterPlottable(AbstractComponent comp); static boolean isOverlaidScatterPlottable(AbstractComponent comp); }
PlotViewPolicy implements Policy { static boolean isCompoundComponentWithAtLeastOneChildThatIsALeafAndThatRequiresAPlot(AbstractComponent component) { if (component.isLeaf()) { return false; } for (AbstractComponent childComponent : component.getComponents()) { if (hasFeed(childComponent)) { return true; } } return false; }  @Override ExecutionResult execute(PolicyContext context); static AbstractComponent[][] getPlotComponents(AbstractComponent targetComponent, boolean ordinalPosition); static boolean isScatterPlottable(AbstractComponent comp); static boolean isOverlaidScatterPlottable(AbstractComponent comp);  }