### Question:
NeutronListener implements ClusteredDataTreeChangeListener<Neutron>, Closeable { @Override public void close() { registeredListener.close(); } NeutronListener(DataBroker dataBroker, NodeId routingNode); @Override void onDataTreeChanged(Collection<DataTreeModification<Neutron>> changes); @Override void close();  }### Answer:
@Test public void constructorTest() { dataBroker = Mockito.spy(dataBroker); NeutronListener neutronListener = new NeutronListener(dataBroker, routingNode); verify(dataBroker).registerDataTreeChangeListener( eq(new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(Neutron.class) .build())), any(NeutronListener.class)); verify(dataBroker).registerDataTreeChangeListener( eq(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(Mappings.class) .child(GbpByNeutronMappings.class) .child(BaseEndpointsByPorts.class) .child(BaseEndpointByPort.class) .build())), any(PortAware.class)); neutronListener.close(); }
@Test public void testProcessCreatedNeutronDto() throws Exception { putPortAndBaseEndpointByPort(); neutronListener.close(); verify(baseEpByPortListener).processCreatedNeutronDto(port); }
@Test public void testProcessUpdatedNeutronDto() throws Exception { putPortAndBaseEndpointByPort(); Port updatedPort = new PortBuilder(port).setName("renamed").build(); WriteTransaction wTx = dataBroker.newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.CONFIGURATION, TestUtils.createPortIid(updatedPort.getKey()), updatedPort); wTx.submit().get(); neutronListener.close(); verify(baseEpByPortListener).processUpdatedNeutronDto(port, updatedPort); }