diff --git a/Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest.cxx b/Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest.cxx index 7e6b4453db3..bde11305341 100644 --- a/Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest.cxx +++ b/Modules/Filtering/QuadEdgeMeshFiltering/test/itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest.cxx @@ -45,16 +45,8 @@ itkDiscreteGaussianCurvatureQuadEdgeMeshFilterTest(int argc, char * argv[]) auto reader = ReaderType::New(); reader->SetFileName(argv[1]); - try - { - reader->Update(); - } - catch (const itk::ExceptionObject & excp) - { - std::cerr << "Exception thrown while reading the input file " << std::endl; - std::cerr << excp << std::endl; - return EXIT_FAILURE; - } + ITK_TRY_EXPECT_NO_EXCEPTION(reader->Update()); + MeshType::Pointer mesh = reader->GetOutput(); diff --git a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx index 8517df08db5..595b31865d0 100644 --- a/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkAutoScaledGradientDescentRegistrationTest.cxx @@ -180,19 +180,8 @@ itkAutoScaledGradientDescentRegistrationTestTemplated(int numberOfIterat std::cout << "GetDoEstimateLearningRateAtEachIteration: " << optimizer->GetDoEstimateLearningRateAtEachIteration() << std::endl; - try - { - optimizer->StartOptimization(); - } - catch (const itk::ExceptionObject & e) - { - std::cout << "Exception thrown ! " << std::endl; - std::cout << "An error occurred during Optimization:" << std::endl; - std::cout << e.GetLocation() << std::endl; - std::cout << e.GetDescription() << std::endl; - std::cout << e.what() << std::endl; - return EXIT_FAILURE; - } + ITK_TRY_EXPECT_NO_EXCEPTION(optimizer->StartOptimization()); + std::cout << "...finished. " << std::endl << "StopCondition: " << optimizer->GetStopConditionDescription() << std::endl diff --git a/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx b/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx index 600bb25dfc1..bb3199c70b8 100644 --- a/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx +++ b/Modules/Numerics/Optimizersv4/test/itkGradientDescentOptimizerBasev4Test.cxx @@ -175,13 +175,9 @@ itkGradientDescentOptimizerBasev4Test(int, char *[]) /* exercise some methods */ optimizer->SetMetric(metric); - if (optimizer->GetMetric() != metric) - { - std::cerr << "Set/GetMetric failed." << std::endl; - return EXIT_FAILURE; - } + ITK_TEST_SET_GET_VALUE(metric, optimizer->GetMetric()); - std::cout << "value: " << optimizer->GetCurrentMetricValue() << std::endl; + ITK_TEST_SET_GET_VALUE(0.0, optimizer->GetCurrentMetricValue()); optimizer->SetNumberOfWorkUnits(2);