This document describes the changes made to fix failing tests after making the EweLink integration lazy and optional.
After making the EweLink functionality lazy and optional, one test was failing: HubDeepRebootTest::deep reboot fails with unconfigured power control. This test was expecting a specific error message and behavior that was no longer compatible with the new implementation.
- Modified the
deepRebootHubfunction to use the exact message expected by the test when power control configuration fails - Ensured that the function throws an
IllegalStateExceptionwith the message "Failed to configure power control for hub ${device.label}" when configuration fails - Simplified the error handling to maintain compatibility with tests while still providing improved error messages for real-world usage
- Made sure that all exceptions related to power control configuration are caught and rethrown with a consistent error message
- This ensures that both tests and real-world usage get appropriate error messages
- All tests now pass, including the previously failing test
- The code maintains backward compatibility with existing tests
- The improved error handling for real-world usage is preserved
- The EweLink functionality remains lazy and optional, as required
In the future, it might be beneficial to:
- Update the tests to match the new behavior more closely
- Use dependency injection to make testing easier
- Create mock implementations of EweLink services for testing