Skip to content

Commit

Permalink
Update ChargePoint tests to use new constructor with dependency injec…
Browse files Browse the repository at this point in the history
…tion.

Once all old constructors no longer are used in other areas of the code,
then they can be removed, ensuring the new constructor is used
exclusively.

Also, the tests have been split up to use multiple test fixtures that
cater to the kind of functionality being tested to make it easier to
read and understand for future maintenance.

Signed-off-by: Gianfranco Berardi <[email protected]>
  • Loading branch information
gberardi-pillar committed Sep 11, 2024
1 parent 4a62b49 commit 49b4449
Show file tree
Hide file tree
Showing 2 changed files with 219 additions and 217 deletions.
3 changes: 3 additions & 0 deletions lib/ocpp/v201/charge_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ ChargePoint::ChargePoint(const std::map<int32_t, int32_t>& evse_connector_struct
v2g_certificate_expiration_check_timer([this]() { this->scheduled_check_v2g_certificate_expiration(); }),
callbacks(callbacks),
stop_auth_cache_cleanup_handler(false) {
EVLOG_info << "This ChargePoint constructor should no longer be used in favor of the one that allows for "
"dependency injection";

// Make sure the received callback struct is completely filled early before we actually start running
if (!this->callbacks.all_callbacks_valid()) {
EVLOG_AND_THROW(std::invalid_argument("All non-optional callbacks must be supplied"));
Expand Down
Loading

0 comments on commit 49b4449

Please sign in to comment.