2 * Copyright (c) 2015 Inocybe 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.ovsdb.openstack.netvirt;
11 import static org.junit.Assert.*;
13 import java.net.HttpURLConnection;
15 import org.junit.Test;
16 import org.mockito.Mockito;
17 import org.opendaylight.ovsdb.plugin.api.Status;
18 import org.opendaylight.ovsdb.plugin.api.StatusCode;
21 * Unit test for {@link AbstractHandler}
23 public class AbstractHandlerTest {
26 public void testAbstractHandler() {
27 Status status = Mockito.mock(Status.class);
29 Mockito.when(status.getCode())
30 .thenReturn(StatusCode.BADREQUEST)
31 .thenReturn(StatusCode.CONFLICT)
32 .thenReturn(StatusCode.NOTACCEPTABLE)
33 .thenReturn(StatusCode.NOTFOUND)
34 .thenReturn(StatusCode.GONE);
37 "Error, getException() did not return the correct neutron API service error",
38 HttpURLConnection.HTTP_BAD_REQUEST,
39 AbstractHandler.getException(status));
41 "Error, getException() did not return the correct neutron API service error",
42 HttpURLConnection.HTTP_CONFLICT,
43 AbstractHandler.getException(status));
45 "Error, getException() did not return the correct neutron API service error",
46 HttpURLConnection.HTTP_NOT_ACCEPTABLE,
47 AbstractHandler.getException(status));
49 "Error, getException() did not return the correct neutron API service error",
50 HttpURLConnection.HTTP_NOT_FOUND,
51 AbstractHandler.getException(status));
53 "Error, getException() did not return the correct neutron API service error",
54 HttpURLConnection.HTTP_INTERNAL_ERROR,
55 AbstractHandler.getException(status));