~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to tests/cpp_unit/Utils/CppErrorHandlerTest.cc

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
#include "json/json.h"
6
6
 
7
 
#include "Interface/Squeal.hh"
 
7
#include "Utils/Exception.hh"
8
8
#include "src/common_cpp/Utils/CppErrorHandler.hh"
9
9
 
10
10
namespace {
13
13
class CppErrorHandlerTest : public ::testing::Test {
14
14
protected:
15
15
  CppErrorHandlerTest() : obj(Json::objectValue), 
16
 
                          squee(Squeal::recoverable, "a_test", "exc::test"),
17
 
                          std_exc(&squee) {
 
16
                          exception(MAUS::Exception::recoverable, "a_test", "exc::test"),
 
17
                          std_exc(&exception) {
18
18
  }
19
19
  virtual ~CppErrorHandlerTest() {}
20
20
  Json::Value obj;
21
 
  Squeal      squee;
 
21
  MAUS::Exception      exception;
22
22
  std::exception* std_exc;  
23
23
};
24
24
 
25
 
TEST_F(CppErrorHandlerTest, HandleSquealTest) {
 
25
TEST_F(CppErrorHandlerTest, HandleExceptionTest) {
26
26
  Json::Value value = 
27
 
           CppErrorHandler::getInstance()->HandleSqueal(obj, squee, "exc_test");
 
27
           CppErrorHandler::getInstance()->HandleException(obj, exception, "exc_test");
28
28
  EXPECT_EQ(value["errors"]["exc_test"][Json::UInt(0)],
29
29
           Json::Value("<class 'ErrorHandler.CppError'>: a_test at exc::test"));
30
30
}
41
41
  // not much to be done here... could check stderr or so?
42
42
}
43
43
 
44
 
TEST_F(CppErrorHandlerTest, HandleSquealNoJsonTest) {
45
 
  CppErrorHandler::getInstance()->HandleSquealNoJson(squee, "exc_test");
 
44
TEST_F(CppErrorHandlerTest, HandleExceptionNoJsonTest) {
 
45
  CppErrorHandler::getInstance()->HandleExceptionNoJson(exception, "exc_test");
46
46
  // not much to be done here... could check stderr or so?
47
47
}
48
48