test: add state check helper method
Reduce duplicate code by providing a simple helper that will perform the
expectation check of a given state.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I37aae09bebc44149671e1510e815dc724bd60c0b
diff --git a/test/firmware_unittest.hpp b/test/firmware_unittest.hpp
index d2eaa2c..2427b82 100644
--- a/test/firmware_unittest.hpp
+++ b/test/firmware_unittest.hpp
@@ -33,6 +33,12 @@
blobs, data, std::move(verifyMock), CreateUpdateMock());
}
+ void expectedState(FirmwareBlobHandler::UpdateState state)
+ {
+ auto realHandler = dynamic_cast<FirmwareBlobHandler*>(handler.get());
+ EXPECT_EQ(state, realHandler->getCurrentState());
+ }
+
ImageHandlerMock imageMock;
std::vector<HandlerPack> blobs;
std::vector<DataHandlerPack> data = {