@@ -0,0 +1,3166 @@
+/*%0A * Copyright (c) 2015 Inocybe and others.  All rights reserved.%0A *%0A * This program and the accompanying materials are made available under the%0A * terms of the Eclipse Public License v1.0 which accompanies this distribution,%0A * and is available at http://www.eclipse.org/legal/epl-v10.html%0A */%0Apackage org.opendaylight.ovsdb.openstack.netvirt.impl;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Random;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Spy;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0Aimport org.opendaylight.ovsdb.openstack.netvirt.api.Constants;%0Aimport org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;%0Aimport org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;%0Aimport org.osgi.framework.ServiceReference;%0A%0A/**%0A * Unit test for class ProviderNetworkManagerImpl%0A *%0A * TODO In order to have deeper tests, private inner class%0A *  ProviderEntry of ProviderNetworkManager should be public.%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ProviderNetworkManagerImplTest %7B%0A%0A    @InjectMocks private ProviderNetworkManagerImpl providerNetworkManagerImpl;%0A    @Spy private HashMap%3CNode, NetworkingProvider%3E nodeToProviderMapping;%0A%0A    private Random r = new Random();%0A%0A    /**%0A     * Test method %7B@link ProviderNetworkManagerImpl#getProvider(Node)%7D%0A     */%0A    @Test%0A    public void testGetProvider()%7B%0A        Node node = mock(Node.class);%0A        NetworkingProvider networkingProvider = mock(NetworkingProvider.class);%0A%0A        // populate nodeToProviderMapping%0A        nodeToProviderMapping.put(node, networkingProvider);%0A%0A        // test when nodeToProviderMapping is populate%0A        assertEquals(%22Error, did not return the networkingProvider of the specified node%22, networkingProvider, providerNetworkManagerImpl.getProvider(node));%0A    %7D%0A%0A    /**%0A     * Test method %7B@link ProviderNetworkManagerImpl#providerAdded(ServiceReference, NetworkingProvider)%7D%0A     */%0A    @Test%0A    public void testProviderAdded()%7B%0A        ServiceReference ref = mock(ServiceReference.class);%0A%0A        // configure ref%0A        when(ref.getProperty(org.osgi.framework.Constants.SERVICE_ID)).thenReturn(r.nextLong());%0A        when(ref.getProperty(Constants.SOUTHBOUND_PROTOCOL_PROPERTY)).thenReturn(%22proto%22);%0A        when(ref.getProperty(Constants.OPENFLOW_VERSION_PROPERTY)).thenReturn(%22of%22);%0A        when(ref.getProperty(Constants.PROVIDER_TYPE_PROPERTY)).thenReturn(%22provider%22);%0A%0A        // nothing much to test%0A        providerNetworkManagerImpl.providerAdded(ref, mock(NetworkingProvider.class));%0A    %7D%0A%0A    /**%0A     * Test method %7B@link ProviderNetworkManagerImpl#providerRemoved(ServiceReference)%7D%0A     */%0A    @Test%0A    public void testProviderRemoved()%7B%0A        ServiceReference ref = mock(ServiceReference.class);%0A%0A        // configure ref%0A        when(ref.getProperty(org.osgi.framework.Constants.SERVICE_ID)).thenReturn(r.nextLong());%0A%0A        // nothing much to test%0A        providerNetworkManagerImpl.providerRemoved(ref);%0A    %7D%0A%7D%0A

Add JUnit testing for ProviderNetworkManagerImpl.