SfcGeniusInterfaceStateListener extends AsyncDataTreeChangeListenerBase<Interface,
        SfcGeniusInterfaceStateListener> { @Override protected void add(InstanceIdentifier<Interface> instanceIdentifier, Interface interfaceState) { LOG.debug("Received interface state add event {} {}", instanceIdentifier, interfaceState); String interfaceName = interfaceState.getName(); BigInteger dpnId; try { dpnId = SfcGeniusUtils.getDpnIdFromLowerLayerIfList(interfaceState.getLowerLayerIf()); } catch (SfcGeniusRuntimeException e) { LOG.debug("Event ignored, could not get underlying dpn id", e); return; } executor.execute(() -> handler.interfaceStateUp(interfaceName, dpnId)); } SfcGeniusInterfaceStateListener(ISfcGeniusInterfaceServiceHandler handler, Executor executor);   }
@Test public void add() throws Exception { sfcGeniusInterfaceStateListener.add(null, anInterface); verify(executor).execute(runnableCaptor.capture()); runnableCaptor.getValue().run(); verify(handler).interfaceStateUp("IF1", BigInteger.valueOf(123456789)); }
@Test public void addNoLowerLayerIf() throws Exception { when(anInterface.getLowerLayerIf()).thenReturn(Collections.emptyList()); sfcGeniusInterfaceStateListener.add(null, anInterface); verifyZeroInteractions(executor); verifyZeroInteractions(handler); }