+/*
+ * 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.controller.northbound.commons.exception;
import javax.ws.rs.core.Response;
import org.junit.Assert;
import org.junit.Test;
-import junit.framework.TestCase;
-
-public class CommonsNorthboundExceptionTest extends TestCase {
+public class CommonsNorthboundExceptionTest {
@Test
public void testMethodNotAllowed() {
try {
throw new InternalServerErrorException("Internal Server Exception");
} catch (InternalServerErrorException e) {
- Assert.assertTrue(e instanceof InternalServerErrorException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Internal Server Exception"));
}
try {
throw new MethodNotAllowedException("Method Not Allowed Exception");
} catch (MethodNotAllowedException e) {
- Assert.assertTrue(e instanceof MethodNotAllowedException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Method Not Allowed Exception"));
}
try {
throw new NotAcceptableException("Not Acceptable Exception");
} catch (NotAcceptableException e) {
- Assert.assertTrue(e instanceof NotAcceptableException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Not Acceptable Exception"));
}
try {
throw new ResourceConflictException("Resource Conflict Exception");
} catch (ResourceConflictException e) {
- Assert.assertTrue(e instanceof ResourceConflictException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Resource Conflict Exception"));
}
try {
throw new ResourceForbiddenException("Resource Forbidden Exception");
} catch (ResourceForbiddenException e) {
- Assert.assertTrue(e instanceof ResourceForbiddenException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Resource Forbidden Exception"));
}
try {
throw new ResourceGoneException("Resource Gone Exception");
} catch (ResourceGoneException e) {
- Assert.assertTrue(e instanceof ResourceGoneException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Resource Gone Exception"));
}
try {
throw new ResourceNotFoundException("Resource Not Found Exception");
} catch (ResourceNotFoundException e) {
- Assert.assertTrue(e instanceof ResourceNotFoundException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Resource Not Found Exception"));
}
throw new ServiceUnavailableException(
"Service Unavailable Exception");
} catch (ServiceUnavailableException e) {
- Assert.assertTrue(e instanceof ServiceUnavailableException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Service Unavailable Exception"));
}
try {
throw new UnauthorizedException("Unauthorized Exception");
} catch (UnauthorizedException e) {
- Assert.assertTrue(e instanceof UnauthorizedException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Unauthorized Exception"));
}
throw new UnsupportedMediaTypeException(
"Unsupported Media Type Exception");
} catch (UnsupportedMediaTypeException e) {
- Assert.assertTrue(e instanceof UnsupportedMediaTypeException);
Assert.assertTrue(e.getResponse().getEntity()
.equals("Unsupported Media Type Exception"));
}