2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.applications.frsync.util;
11 import java.util.Date;
12 import org.junit.Assert;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.junit.runner.RunWith;
16 import org.mockito.runners.MockitoJUnitRunner;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
20 * Test for {@link ReconciliationRegistry}.
22 @RunWith(MockitoJUnitRunner.class)
23 public class ReconciliationRegistryTest {
25 private static final NodeId NODE_ID = new NodeId("testNode");
26 private ReconciliationRegistry reconciliationRegistry;
29 public void setUp() throws Exception {
30 reconciliationRegistry = new ReconciliationRegistry();
34 public void testRegister() {
35 Date timestamp = reconciliationRegistry.register(NODE_ID);
36 Assert.assertEquals(true, reconciliationRegistry.isRegistered(NODE_ID));
37 Assert.assertNotNull(timestamp);
41 public void testUnregisterIfRegistered() {
42 reconciliationRegistry.register(NODE_ID);
43 Date timestamp = reconciliationRegistry.unregisterIfRegistered(NODE_ID);
44 Assert.assertEquals(false, reconciliationRegistry.isRegistered(NODE_ID));
45 Assert.assertNotNull(timestamp);
49 public void testUnregisterIfNotRegistered() {
50 Date timestamp = reconciliationRegistry.unregisterIfRegistered(NODE_ID);
51 Assert.assertEquals(false, reconciliationRegistry.isRegistered(NODE_ID));
52 Assert.assertNull(timestamp);