### Question:
PortHandler implements TransactionChainListener { @VisibleForTesting void processCreatedData(Port port, BaseEndpointByPort bebp) { if (isValidVhostUser(port) || isValidVppRouterPort(port)) { VppEndpoint vppEp = buildVppEndpoint(port, bebp); if (vppEp == null) { LOG.warn("Cannot create vpp-endpoint from neutron port {}", port); return; } writeVppEndpoint(createVppEndpointIid(vppEp.getKey()), vppEp); LOG.debug("Created vpp-endpoint {}", vppEp); } } PortHandler(DataBroker dataBroker, NodeId routingNodeId); static Optional<FixedIps> resolveFirstFixedIps(Port port); @Override void onTransactionChainFailed(TransactionChain<?, ?> chain, AsyncTransaction<?, ?> transaction,
            Throwable cause); @Override void onTransactionChainSuccessful(TransactionChain<?, ?> chain);  }### Answer:
@Test public void testProcessCreatedData() throws Exception { portHandler.processCreatedData(port, bebp); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx); assertTrue(optVppEp.isPresent()); }
@Test public void testProcessCreatedData_notValidVppEp() throws Exception { port = TestUtils.createNonVppPort(); portHandler.processCreatedData(port, bebp); ReadOnlyTransaction rTx = dataBroker.newReadOnlyTransaction(); Optional<VppEndpoint> optVppEp = DataStoreHelper.readFromDs(LogicalDatastoreType.CONFIGURATION, TestUtils.createVppEpIid(TestUtils.createVppEndpointKey(bebp)), rTx); assertFalse(optVppEp.isPresent()); }