@@ -0,0 +1,3411 @@
+/*%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 */%0A%0Apackage org.opendaylight.ovsdb.openstack.netvirt;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.net.HttpURLConnection;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0Aimport org.opendaylight.neutron.spi.NeutronRouter;%0Aimport org.opendaylight.neutron.spi.NeutronRouter_Interface;%0Aimport org.opendaylight.ovsdb.openstack.netvirt.api.Action;%0Aimport org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;%0A%0A/**%0A * Unit test fort %7B@link RouterHandler%7D%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class RouterHandlerTest %7B%0A%0A    @InjectMocks RouterHandler routerHandler;%0A%0A    @Mock NeutronL3Adapter neutronL3Adapter;%0A%0A    @Test%0A    public void testCanCreateRouter() %7B%0A        assertEquals(%22Error, canCreateRouter() did not return the correct HTTP flag%22, HttpURLConnection.HTTP_OK, routerHandler.canCreateRouter(mock(NeutronRouter.class)));%0A    %7D%0A%0A    @Test%0A    public void testCanUpdateRouter() %7B%0A        assertEquals(%22Error, canUpdateRouter() did not return the correct HTTP flag%22, HttpURLConnection.HTTP_OK, routerHandler.canUpdateRouter(mock(NeutronRouter.class), mock(NeutronRouter.class)));%0A    %7D%0A%0A    @Test%0A    public void testCanDeleteRouter() %7B%0A        assertEquals(%22Error, canDeleteRouter() did not return the correct HTTP flag%22, HttpURLConnection.HTTP_OK, routerHandler.canDeleteRouter(mock(NeutronRouter.class)));%0A    %7D%0A%0A    @Test%0A    public void testCanAttachAndDettachInterface() %7B%0A        NeutronRouter router = mock(NeutronRouter.class);%0A        when(router.getName()).thenReturn(%22router_name%22);%0A%0A        NeutronRouter_Interface routerInterface = mock(NeutronRouter_Interface.class);%0A        when(routerInterface.getPortUUID()).thenReturn(%22portUUID%22);%0A        when(routerInterface.getSubnetUUID()).thenReturn(%22subnetUUID%22);%0A%0A        assertEquals(%22Error, canAttachInterface() did not return the correct HTTP flag%22, HttpURLConnection.HTTP_OK, routerHandler.canAttachInterface(router, routerInterface));%0A        assertEquals(%22Error, canDetachInterface() did not return the correct HTTP flag%22, HttpURLConnection.HTTP_OK, routerHandler.canDetachInterface(router, routerInterface));%0A    %7D%0A%0A    @Test%0A    public void testProcessEvent() %7B%0A        NorthboundEvent ev = mock(NorthboundEvent.class);%0A%0A        when(ev.getAction()).thenReturn(Action.UPDATE);%0A        when(ev.getRouter()).thenReturn(mock(NeutronRouter.class));%0A        when(ev.getRouterInterface())%0A                                .thenReturn(null)%0A                                .thenReturn(mock(NeutronRouter_Interface.class));%0A%0A        routerHandler.processEvent(ev);%0A        verify(neutronL3Adapter, times(1)).handleNeutronRouterEvent(ev.getRouter(), Action.UPDATE);%0A        routerHandler.processEvent(ev);%0A        verify(neutronL3Adapter, times(1)).handleNeutronRouterInterfaceEvent(ev.getRouter(), ev.getRouterInterface(), Action.UPDATE);%0A    %7D%0A%7D%0A

Add JUnit testing for RouterHandler class.