regulators: Complete PMBusReadSensorAction class
Complete implementation of the PMBusReadSensorAction class. Publish the
sensor value on D-Bus using the Sensors service.
Update gtests for this class to expect calls to the Sensors service.
Fix some constructor parameter combinations that did not make sense,
such as linear_16 format for non-voltage sensors.
Also refactor the TestSDBusError exception class into a separate file.
This allows it to be shared by multiple test cases. This class is a
concrete implementation of the abstract sdbusplus::exception_t class
used for D-Bus errors.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I5a77616b2ae5b17224c296aeee88019512649589
diff --git a/phosphor-regulators/test/presence_detection_tests.cpp b/phosphor-regulators/test/presence_detection_tests.cpp
index c63f403..0de5919 100644
--- a/phosphor-regulators/test/presence_detection_tests.cpp
+++ b/phosphor-regulators/test/presence_detection_tests.cpp
@@ -27,6 +27,7 @@
#include "presence_detection.hpp"
#include "rule.hpp"
#include "system.hpp"
+#include "test_sdbus_error.hpp"
#include <sdbusplus/exception.hpp>
@@ -47,35 +48,6 @@
using ::testing::Throw;
/**
- * Concrete subclass of sdbusplus::exception_t abstract base class.
- */
-class TestSDBusError : public sdbusplus::exception_t
-{
- public:
- TestSDBusError(const std::string& error) : error{error}
- {
- }
-
- const char* what() const noexcept override
- {
- return error.c_str();
- }
-
- const char* name() const noexcept override
- {
- return "";
- }
-
- const char* description() const noexcept override
- {
- return "";
- }
-
- private:
- const std::string error{};
-};
-
-/**
* Creates the parent objects that normally contain a PresenceDetection object.
*
* A PresenceDetection object is normally contained within a hierarchy of