/*
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.protocol.concepts;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.junit.Test;

public class MultiRegistryTest {

    @Test
    public void testMultiRegistry() {
        MultiRegistry<Object, Integer> registry = new MultiRegistry<>();
        String first = "first";
        String second = "second";
        String third = "third";

        AbstractRegistration a = registry.register(first, 1);
        registry.register(second, 2);
        registry.register(third, 3);

        assertEquals(Integer.valueOf(1), registry.get("first"));
        assertEquals(Integer.valueOf(2), registry.get("second"));
        assertEquals(Integer.valueOf(3), registry.get("third"));

        registry.register(second, 22);

        assertEquals(Integer.valueOf(22), registry.get("second"));

        registry.register(Character.valueOf('c'), 5);

        assertEquals(Integer.valueOf(5), registry.get('c'));

        a.close();

        assertNull(registry.get("first"));
    }
}

@@ -434,17 +434,16 @@
 rtNull;%0A
-%0A
 import o
@@ -548,16 +548,22 @@
         
+final 
 MultiReg
@@ -623,24 +623,30 @@
 ();%0A        
+final 
 String first
@@ -661,24 +661,30 @@
 t%22;%0A        
+final 
 String secon
@@ -705,16 +705,22 @@
         
+final 
 String t
@@ -744,16 +744,22 @@
         
+final 
 Abstract
@@ -1371,10 +1371,1363 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void testDifferentNumbers() %7B%0A        final MultiRegistry%3CObject, Number%3E registry = new MultiRegistry%3C%3E();%0A        final String first = %22first%22;%0A%0A        registry.register(first, new Integer(1));%0A        assertEquals(Integer.valueOf(1), registry.get(%22first%22));%0A%0A        registry.register(first, new Short((short) 1));%0A        assertEquals(Integer.valueOf(1), registry.get(%22first%22));%0A%0A        registry.register(first, new Short((short) 2));%0A        assertEquals(Integer.valueOf(1), registry.get(%22first%22));%0A    %7D%0A%0A    @Test%0A    public void testDifferentClasses() %7B%0A        final MultiRegistry%3CObject, Object%3E registry = new MultiRegistry%3C%3E();%0A        final String first = %22first%22;%0A        final String second = %22second%22;%0A%0A        registry.register(first, new Integer(1));%0A        assertEquals(Integer.valueOf(1), registry.get(%22first%22));%0A%0A        registry.register(first, new Character('1'));%0A        assertEquals(Integer.valueOf(1), registry.get(%22first%22));%0A%0A        registry.register(second, new Character('2'));%0A        assertEquals(Character.valueOf('2'), registry.get(%22second%22));%0A%0A        registry.register(second, new Integer(2));%0A        assertEquals(Character.valueOf('2'), registry.get(%22second%22));%0A%0A        registry.register(second, new Object());%0A        assertEquals(Character.valueOf('2'), registry.get(%22second%22));%0A    %7D%0A%0A
 %7D%0A

Update of Unit test