Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Plugins / JSONReader / Test / vtkJSONParserTest.cxx
index 256461f2ac8caba3170c1de14b9971fa72c3116b..50fde39b7e703b0e8f59d39d4a90aae5f2814425 100644 (file)
@@ -1,9 +1,9 @@
-//  Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2015-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -75,16 +75,17 @@ void vtkJSONParserTest::testParseBadFiles() {
     vtkTable* table = vtkTable::New();
     Parser->SetFileName(s.c_str());
     bool expected_exception_thrown = false;
-    try{
-      Parser->Parse(table);
-    } catch(vtkJSONException e) {
-      expected_exception_thrown = true;
-    }
+    CPPUNIT_ASSERT_THROW(Parser->Parse(table), vtkJSONException);
+//    try{
+//      ;
+//    } catch(vtkJSONException e) {
+//      expected_exception_thrown = true;
+//    }
     Parser->Delete();
     table->Delete();
-    if(!expected_exception_thrown) {
-      CPPUNIT_FAIL("Expected exception is not thrown !!! ");
-    }
+//    if(!expected_exception_thrown) {
+//      CPPUNIT_FAIL("Expected exception is not thrown !!! ");
+//    }
   }
 }
 
@@ -104,18 +105,18 @@ void vtkJSONParserTest::testParseGoodFiles() {
     vtkJSONParser* Parser = vtkJSONParser::New();
     vtkTable* table = vtkTable::New();
     Parser->SetFileName(s.c_str());
-    bool exception_thrown = false;
-    try{
+//    bool exception_thrown = false;
+//    try{
       Parser->Parse(table);
-    } catch(vtkJSONException e) {
-      exception_thrown = true;
-    }
+//    } catch(vtkJSONException e) {
+//      exception_thrown = true;
+//    }
     Parser->Delete();
     table->Delete();
     
-    if(exception_thrown) {
-      CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
-    }
+//    if(exception_thrown) {
+//      CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
+//    }
   }
 
   vtkJSONParser* Parser = vtkJSONParser::New();
@@ -128,14 +129,14 @@ void vtkJSONParserTest::testParseGoodFiles() {
   s += "_wo_metadata.json";
   Parser->SetFileName(s.c_str());
   bool exception_thrown = false;
-  try{
+//  try{
     Parser->Parse(table);
-  } catch(vtkJSONException e) {
-    exception_thrown = true;      
-  }    
-  if(exception_thrown) {
-    CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
-  }
+//  } catch(vtkJSONException e) {
+//    exception_thrown = true;
+//  }
+//  if(exception_thrown) {
+//    CPPUNIT_FAIL("Unexpected exception has been thrown !!! ");
+//  }
 
   double v = table->GetValue(2,0).ToDouble();
   double v1 = table->GetValue(2,1).ToDouble();