test(inputdevices): add unit tests for UltraSonicSensorHelper - #362
Merged
leandrumartin merged 6 commits intoSep 19, 2025
Merged
Conversation
9 tasks
leandrumartin
requested changes
Sep 17, 2025
j-heitz
marked this pull request as ready for review
September 18, 2025 20:43
Collaborator
|
Maybe your PR description is outdated, but under "Files Changed" it only lists one file, when in fact two are changed as you write elsewhere in the description. Always check LLM output carefully. |
leandrumartin
approved these changes
Sep 19, 2025
leandrumartin
deleted the
361-write-unit-tests-for-ultrasonicsensorhelper
branch
September 19, 2025 22:36
Collaborator
|
Congrats on your first PR merge! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves issue #361
Summary
Add comprehensive JUnit tests for
com.opensourcewithslu.inputdevices.UltraSonicSensorHelper. Tests cover initialization, start/stop behavior, measurement flow, distance calculations (cm/m), and edge cases (negative duration, echo timeout). Logger is injected and assertions around logging are included where appropriate.Motivation
Improve unit test coverage for sensor logic so changes are safer and hardware-independent. Tests mock GPIO interactions allowing CI to run without physical devices.
Changes
UltraSonicSensorHelperto allow testing of log messages and added log messages instartMeasuringandstopMeasuringFiles changed
How to test
./gradlew test