ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
testEventLogObserver.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_ocm_libdaq_test
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Unit test for types declared in daq/eventLogObserverLogger.hpp
7  */
9 #include <sstream>
10 
11 #include <gtest/gtest.h>
12 #include <gmock/gmock.h>
13 
14 using namespace ::testing;
15 using namespace ::daq;
16 
17 class TestEventLogObserverLogger : public ::testing::Test {
18 public:
19  TestEventLogObserverLogger() : m_logger(log4cplus::Logger::getInstance("test")) {
20  }
21  log4cplus::Logger m_logger;
22 };
23 
25  EXPECT_NO_THROW(EventLogObserverLogger{m_logger});
26 }
27 
28 TEST_F(TestEventLogObserverLogger, LoggingDoesNotThrow) {
29  // Setup
30  auto logger = EventLogObserverLogger(m_logger);
31 
32  // Run
33  EXPECT_NO_THROW(logger(ErrorEvent("id", "test error", {}, "origin")));
34  EXPECT_NO_THROW(logger(GenericEvent("id", "test descriptionor", {})));
35  EXPECT_NO_THROW(logger(ActionEvent("id", "test description", {})));
36  EXPECT_NO_THROW(logger(UserActionEvent("id", "test description", {})));
37 }
TestEventLogObserverLogger::m_logger
log4cplus::Logger m_logger
Definition: testEventLogObserver.cpp:21
eventLogObserver.hpp
Contains declaration for EventLogObserverLogger.
daq
Definition: asyncProcess.cpp:15
TEST_F
TEST_F(TestEventLogObserverLogger, Construction)
Definition: testEventLogObserver.cpp:24
TestEventLogObserverLogger::TestEventLogObserverLogger
TestEventLogObserverLogger()
Definition: testEventLogObserver.cpp:19
TestEventLogObserverLogger
Definition: testEventLogObserver.cpp:17