sal-rest-connector test refactoring
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / cnsn / to / xml / test / CnSnToXmlNotExistingLeafTypeTest.java
index a2fc138b519e0e53af179074c27f84e37ad33e86..d779b5ce7b5b71e8c56fef7afe6fc45f62e1d844 100644 (file)
@@ -31,15 +31,16 @@ public class CnSnToXmlNotExistingLeafTypeTest {
     @Test
     public void incorrectTopLevelElementTest() {
 
-        String xmlOutput = null;
+        boolean nullPointerExceptionRaised = false;
         try {
-            xmlOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
+            TestUtils.writeCompNodeWithSchemaContextToOutput(prepareCompositeNode(),
                     (Set<Module>) Collections.EMPTY_SET, prepareDataSchemaNode(), StructuredDataToXmlProvider.INSTANCE);
         } catch (WebApplicationException | IOException e) {
             LOG.error("WebApplicationException or IOException was raised");
+        } catch (NullPointerException e) {
+            nullPointerExceptionRaised = true;
         }
-        assertNotNull(xmlOutput);
-        assertTrue(xmlOutput.contains("<lf1>any value</lf1>"));
+        assertTrue(nullPointerExceptionRaised);
 
     }