/*
 * Copyright (c) 2015 Inocybe 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.ovsdb.openstack.netvirt;

import static org.junit.Assert.*;

import java.net.HttpURLConnection;

import org.junit.Test;
import org.mockito.Mockito;
import org.opendaylight.ovsdb.plugin.api.Status;
import org.opendaylight.ovsdb.plugin.api.StatusCode;

/**
 * Unit test for {@link AbstractHandler}
 */
public class AbstractHandlerTest {

    @Test
    public void testAbstractHandler() {
        Status status = Mockito.mock(Status.class);

        Mockito.when(status.getCode())
                .thenReturn(StatusCode.BADREQUEST)
                .thenReturn(StatusCode.CONFLICT)
                .thenReturn(StatusCode.NOTACCEPTABLE)
                .thenReturn(StatusCode.NOTFOUND)
                .thenReturn(StatusCode.GONE);

        assertEquals(
                "Error, getException() did not return the correct neutron API service error",
                HttpURLConnection.HTTP_BAD_REQUEST,
                AbstractHandler.getException(status));
        assertEquals(
                "Error, getException() did not return the correct neutron API service error",
                HttpURLConnection.HTTP_CONFLICT,
                AbstractHandler.getException(status));
        assertEquals(
                "Error, getException() did not return the correct neutron API service error",
                HttpURLConnection.HTTP_NOT_ACCEPTABLE,
                AbstractHandler.getException(status));
        assertEquals(
                "Error, getException() did not return the correct neutron API service error",
                HttpURLConnection.HTTP_NOT_FOUND,
                AbstractHandler.getException(status));
        assertEquals(
                "Error, getException() did not return the correct neutron API service error",
                HttpURLConnection.HTTP_INTERNAL_ERROR,
                AbstractHandler.getException(status));
    }
}

@@ -372,17 +372,291 @@
 .Assert.
-*
+assertEquals;%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.times;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.verifyNoMoreInteractions;%0Aimport static org.mockito.Mockito.when
 ;%0A%0Aimpor
@@ -720,31 +720,72 @@
 ort org.
-mockito.Mockito
+opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher
 ;%0Aimport
@@ -880,17 +880,16 @@
 usCode;%0A
-%0A
 /**%0A * U
@@ -1039,24 +1039,16 @@
 tatus = 
-Mockito.
 mock(Sta
@@ -1068,24 +1068,16 @@
         
-Mockito.
 when(sta
@@ -2462,11 +2462,334 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testEnqueueEvent()%7B%0A        EventDispatcher eventDispatcher = mock(EventDispatcher.class);%0A%0A        verifyNoMoreInteractions(eventDispatcher);%0A        eventDispatcher.enqueueEvent(mock(AbstractEvent.class));%0A        verify(eventDispatcher, times(1)).enqueueEvent(any(AbstractEvent.class));%0A    %7D
 %0A%7D%0A

Add test case for enqueueEvent() for AbstractHandler class.