Do not generate 'isFoo()' methods
[mdsal.git] / dom / mdsal-dom-api / src / test / java / org / opendaylight / mdsal / dom / api / DOMExceptionsTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.dom.api;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13
14 import java.net.URI;
15 import org.junit.Test;
16 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.common.QNameModule;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20
21 @Deprecated
22 public class DOMExceptionsTest {
23     private static final String TEST_MESSAGE = "TestMessage";
24     private static final String TEST_LISTS = "test-lists";
25     private static final QNameModule TEST_MODULE = QNameModule.create(URI.create(
26             "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:store"));
27     private static final YangInstanceIdentifier TEST_YI_ID = YangInstanceIdentifier.create(
28             new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_MODULE, TEST_LISTS)));
29     private static final DOMDataTreeIdentifier TEST_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL,
30             TEST_YI_ID);
31
32     @Test(expected = DOMDataTreeInaccessibleException.class)
33     public void testDomDataTreeInaccessibleException() throws Exception {
34         final DOMDataTreeInaccessibleException testExc = new DOMDataTreeInaccessibleException(TEST_TREE, TEST_MESSAGE);
35         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
36         assertNotNull(testExc.getTreeIdentifier());
37         assertEquals(TEST_TREE, testExc.getTreeIdentifier());
38
39         throw new DOMDataTreeInaccessibleException(TEST_TREE, TEST_MESSAGE, new Throwable());
40     }
41
42     @Test(expected = DOMDataTreeListeningException.class)
43     public void testDomDataTreeListeningException() throws Exception {
44         final DOMDataTreeListeningException testExc = new DOMDataTreeListeningException(TEST_MESSAGE);
45         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
46
47         throw new DOMDataTreeListeningException(TEST_MESSAGE, new Throwable());
48     }
49
50     @Test(expected = DOMDataTreeLoopException.class)
51     public void testDomDataTreeLoopException() throws Exception {
52         final DOMDataTreeLoopException testExc = new DOMDataTreeLoopException(TEST_MESSAGE);
53         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
54
55         throw new DOMDataTreeLoopException(TEST_MESSAGE, new Throwable());
56     }
57
58     @Test(expected = DOMDataTreeProducerBusyException.class)
59     public void testDomDataTreeProducerBusyException() throws Exception {
60         final DOMDataTreeProducerBusyException testExc = new DOMDataTreeProducerBusyException(TEST_MESSAGE);
61         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
62
63         throw new DOMDataTreeProducerBusyException(TEST_MESSAGE, new Throwable());
64     }
65
66     @Test(expected = DOMDataTreeProducerException.class)
67     public void testDOMDataTreeProducerException() throws Exception {
68         final DOMDataTreeProducerException testExc = new DOMDataTreeProducerException(TEST_MESSAGE);
69         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
70
71         throw new DOMDataTreeProducerException(TEST_MESSAGE, new Throwable());
72     }
73
74     @Test(expected = DOMDataTreeShardingConflictException.class)
75     public void testDOMDataTreeShardingConflictException() throws Exception {
76         final DOMDataTreeShardingConflictException testExc = new DOMDataTreeShardingConflictException(TEST_MESSAGE);
77         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
78
79         throw new DOMDataTreeShardingConflictException(TEST_MESSAGE, new Throwable());
80     }
81
82     @Test(expected = DOMNotificationRejectedException.class)
83     public void testDomNotificationRejectedException() throws Exception {
84         final DOMNotificationRejectedException testExc = new DOMNotificationRejectedException(TEST_MESSAGE);
85         assertTrue(testExc.getMessage().contains(TEST_MESSAGE));
86
87         throw new DOMNotificationRejectedException(TEST_MESSAGE, new Throwable());
88     }
89
90     @Test(expected = DOMRpcImplementationNotAvailableException.class)
91     public void testDomRpcImplementationNotAvailableException() throws Exception {
92         final DOMRpcImplementationNotAvailableException dompcImplementationNotAvailableException
93             = new DOMRpcImplementationNotAvailableException(TEST_MESSAGE);
94         assertTrue(dompcImplementationNotAvailableException.getMessage().contains(TEST_MESSAGE));
95
96         throw new DOMRpcImplementationNotAvailableException(new Throwable(), TEST_MESSAGE, new Object());
97     }
98 }