Skip to content

Write unit tests for PassiveBuzzerHelper #358

Description

@leandrumartin

We need to create unit tests for the PassiveBuzzerHelper class located in com.opensourcewithslu.outputdevices. This class controls a passive buzzer, which uses a pulsating AC signal to generate a tone.

Notes

  • Verify that the component initializes with the correct configuration.
  • Validate that the buzzer can be turned on and off.
  • Validate that the frequency outputted by the buzzer can be changed.
  • Test the passiveBuzzTone method to ensure it turns the buzzer on, buzzes for one second, then turns the buzzer off.
  • Test that the toneIterator method turns the buzzer on, correctly plays each of its frequencies for one second each, then turns the buzzer off.
  • Test that the piToneSequence method correctly turns the buzzer on plays, frequencies representing the first ten digits of pi, then turns the buzzer off.

Acceptance Criteria

  • All test cases detailed above are implemented.
  • Tests validate expected behavior for all methods.
  • Tests validate all cases where a method should fail, and that appropriate error messages are provided.
  • Tests handle edge cases.
  • Tests are written using the Java JUnit Jupiter framework.
  • Tests are written in the com.opensourcewithslu.outputdevices package in the pi4micronaut-utils/src/test directory.
  • The Pwm class is mocked using the Mockito framework, or a similar tool.
  • Tests validate that appropriate log messages are sent by each relevant method.
  • All tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    iteration-starterA task to help team members kick off a sprint.unit-testTo ensure individual components or functions work as intended.

    Type

    Projects

    Status
    Dev Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions