OFRendererFlowManagerProvider implements OFRendererFlowService, Observer, AutoCloseable { protected boolean isRedirect(final Intent intent) { Action actionContainer = null; try { actionContainer = IntentUtils.getAction(intent); } catch (IntentInvalidException e) { LOG.error(e.getMessage()); throw new NoSuchElementException(e.getMessage()); } return (Redirect.class.isInstance(actionContainer)); } OFRendererFlowManagerProvider(final DataBroker dataBroker,
                                         final PipelineManager pipelineManager,
                                         final IdManagerService idManagerService); @Override void start(); @Override void pushIntentFlow(final Intent intent, final FlowAction flowAction); @Override void pushARPFlow(final NodeId nodeId, final FlowAction flowAction); @Override void close(); @Override void pushLLDPFlow(final NodeId nodeId, final FlowAction flowAction); @Override synchronized Dataflow pushDataFlow(Dataflow dataFlow); Dataflow sendDataflow(final Dataflow dataflow); @Override void pushDataFlow(final NodeId nodeId, final Dataflow dataflow); @Override MeterId createMeter(final String id, final long dropRate); @Override void removeMeter(final Long meterId, final String dataflowId); @Override void update(); @Override void setSubject(final Subject sub); @Override void stop();  }
@Test(expected = NoSuchElementException.class) public void testIsRedirectWithNoSuchElementException() { when(actions.getAction()).thenReturn(null); ofRendererFlowManagerProvider.isRedirect(intent); }
@Test public void testIsRedirect() { when(actions.getAction()).thenReturn(redirect); Assert.assertTrue(ofRendererFlowManagerProvider.isRedirect(intent)); }
@Test public void testIsRedirectFalse() { when(actions.getAction()).thenReturn(action); Assert.assertFalse(ofRendererFlowManagerProvider.isRedirect(intent)); }