SimpleIrdListener implements AutoCloseable, DataTreeChangeListener<IrdInstanceConfiguration> { public void register(DataBroker dataBroker, InstanceIdentifier<IrdInstanceConfiguration> iid) { mDataBroker = dataBroker; mIID = iid; mReg = mDataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>( LogicalDatastoreType.CONFIGURATION, mIID), this); LOG.info("SimpleIrdListener registered"); } SimpleIrdListener(Uuid context); void register(DataBroker dataBroker, InstanceIdentifier<IrdInstanceConfiguration> iid); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<IrdInstanceConfiguration>> changes); @Override synchronized void close();  }
@SuppressWarnings("unchecked") @Test public void register() throws Exception { InstanceIdentifier<IrdInstanceConfiguration> iicIID = InstanceIdentifier.builder(IrdInstanceConfiguration.class).build(); simpleIrdListener.register(m_dataBroker, iicIID); verify(m_dataBroker, times(2)).registerDataTreeChangeListener(new DataTreeIdentifier<>( LogicalDatastoreType.CONFIGURATION, iicIID), this.simpleIrdListener); }