PlotStringPolicy implements Policy { @Override public ExecutionResult execute(PolicyContext context) { ViewInfo viewInfo = context.getProperty( PolicyContext.PropertyName.TARGET_VIEW_INFO.getName(), ViewInfo.class); if (viewInfo.getViewClass().equals(PlotViewManifestation.class)) { FeedProvider provider = context.getProperty( PolicyContext.PropertyName.TARGET_COMPONENT.getName(), FeedProvider.class); if (provider != null) { if (provider.getFeedType() == FeedType.STRING) { return new ExecutionResult(context, false, EM_STRING); } } } return new ExecutionResult(context, true, EM_STRING); }  @Override ExecutionResult execute(PolicyContext context);  }
@Test public void testFeedTypes() { for (FeedType ft : FeedType.values()) { Mockito.when(mockProvider.getFeedType()).thenReturn(ft); Assert.assertEquals(policy.execute(context).getStatus(), ft != FeedType.STRING); } }