### Question:
EndpointRpcRegistry implements EndpointService, EpRendererAugmentationRegistry, AutoCloseable { @Override public Future<RpcResult<Void>> registerEndpoint(RegisterEndpointInput input) { long timestamp = System.currentTimeMillis(); WriteTransaction t = dataProvider.newWriteOnlyTransaction(); if (input.getL2Context() != null && input.getMacAddress() != null) { Endpoint ep = buildEndpoint(input).setTimestamp(timestamp).build(); EndpointKey key = new EndpointKey(ep.getL2Context(), ep.getMacAddress()); t.put(LogicalDatastoreType.OPERATIONAL, IidFactory.endpointIid(key), ep, true); } if (input.getL3Address() != null) { for (L3Address l3addr : input.getL3Address()) { EndpointL3Key key3 = new EndpointL3Key(l3addr.getIpAddress(), l3addr.getL3Context()); EndpointL3 ep3 = buildEndpointL3(input).setIpAddress(key3.getIpAddress()) .setL3Context(key3.getL3Context()) .setTimestamp(timestamp) .build(); t.put(LogicalDatastoreType.OPERATIONAL, IidFactory.l3EndpointIid(key3), ep3, true); } } ListenableFuture<Void> r = t.submit(); return Futures.transform(r, futureTrans, MoreExecutors.directExecutor()); } EndpointRpcRegistry(DataBroker dataProvider); @Override void register(EpRendererAugmentation epRendererAugmentation); @Override void unregister(EpRendererAugmentation regImp); @Override void close(); @Override Future<RpcResult<Void>> registerEndpoint(RegisterEndpointInput input); @Override Future<RpcResult<Void>> registerL3PrefixEndpoint(RegisterL3PrefixEndpointInput input); @Override Future<RpcResult<Void>> unregisterEndpoint(UnregisterEndpointInput input); @Override Future<RpcResult<Void>> setEndpointGroupConditions(SetEndpointGroupConditionsInput input); @Override Future<RpcResult<Void>> unsetEndpointGroupConditions(UnsetEndpointGroupConditionsInput input);  }### Answer:
@Test public void testRegisterEndpoint() throws Exception { WriteTransaction wt = newWriteTransactionMock(); endpointRpcRegistry.registerEndpoint(setRegisterEndpointVariablesForTest()); verify(wt, times(1)).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class), eq(true)); endpointRpcRegistry.registerEndpoint(setL3AddressVariableForTest()); verify(wt, times(2)).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class), eq(true)); }