oss-slu / Pi4Micronaut

A java library combining Micronaut and Pi4j to streamline hardware connectivity to Raspberry Pi's
https://oss-slu.github.io/Pi4Micronaut/
Apache License 2.0
8 stars 7 forks source link

249 push button helper tests #251

Closed Ed0827 closed 2 months ago

Ed0827 commented 2 months ago

Fixes #249

Updated the gradle build for JUnit.

Added unit tests for PushButtonHelper initialization.

This issue was needed to change because it involves setting up and verifying fundamental functionality, which makes it suitable for newcomers.

Created an instance of the class named MOckDigitalInput to simulates the behavior of a real object in controlled ways, without needing the real hardware or dependencies. Hence, it mimics the behavior of a real digital input device, such as a push button connected to a Raspberry Pi's GPIO pins. Tested the case isPressed to simulate different conditions like the button being pressed or not by setting specific states that created: DigitalState.LOW or DigitalState.HIGH.

CLAassistant commented 2 months ago

CLA assistant check
All committers have signed the CLA.

yrlmanoharreddy commented 2 months ago

Your implementation of the MockDigitalInput class effectively simulates the behavior of digital input devices, which is crucial for testing without real hardware. However, there are some areas for improvement.

For better code quality, remove unused code from the MockDigitalInput class to maintain clarity and prevent confusion. The approach is solid. Great work so far—looking forward to the revisions!

Please make these changes and push the updated code