Move SendErrorExceptionUtil
[netconf.git] / netconf / netconf-util / src / test / java / org / opendaylight / netconf / util / mapping / AbstractNetconfOperationTest.java
index ad3ab9eaa0b2b143a37758f0e212dd2f331274b8..5420432f01f568eaf1cf49f6badbe343b3a88750 100644 (file)
@@ -27,12 +27,10 @@ import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
 public class AbstractNetconfOperationTest {
-
-    class NetconfOperationImpl extends AbstractNetconfOperation {
-
+    static class NetconfOperationImpl extends AbstractNetconfOperation {
         public boolean handleRun;
 
-        protected NetconfOperationImpl(String netconfSessionIdForReporting) {
+        protected NetconfOperationImpl(final String netconfSessionIdForReporting) {
             super(netconfSessionIdForReporting);
             this.handleRun = false;
         }
@@ -43,23 +41,22 @@ public class AbstractNetconfOperationTest {
         }
 
         @Override
-        protected Element handle(Document document, XmlElement message,
-                                 NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
+        protected Element handle(final Document document, final XmlElement message,
+                final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
             this.handleRun = true;
             try {
                 return XmlUtil.readXmlToElement("<element/>");
             } catch (SAXException | IOException e) {
-                throw new RuntimeException(e);
+                throw DocumentedException.wrap(e);
             }
         }
     }
 
-    private NetconfOperationImpl netconfOperation;
+    private final NetconfOperationImpl netconfOperation = new NetconfOperationImpl("str");
     private NetconfOperationChainedExecution operation;
 
     @Before
     public void setUp() throws Exception {
-        netconfOperation = new NetconfOperationImpl("str");
         operation = mock(NetconfOperationChainedExecution.class);
     }