Skip to content

RFidHelperTest class - #430

Merged
leandrumartin merged 3 commits into
developfrom
359-write-unit-tests-for-rfidhelper
Nov 17, 2025
Merged

RFidHelperTest class#430
leandrumartin merged 3 commits into
developfrom
359-write-unit-tests-for-rfidhelper

Conversation

@ThomasPautler952194

Copy link
Copy Markdown
Collaborator

Pull Request Summary

Closes #359
New Test class for RFidHelper

test included

  • constructor_WithResetPin_CreatesComponent
    Verifies that the RFidHelper constructor with a reset pin creates exactly one RfidComponent instance.
    • constructor_WithoutResetPin_CreatesComponent
      Ensures the constructor without a reset pin also creates exactly one RfidComponent.
    • constructor_NullContext_ThrowsNPE
      Confirms that passing null for the Context throws a NullPointerException.
    • constructor_NullSpiConfig_ThrowsNPE
      Confirms that passing null for SpiConfig throws a NullPointerException.
    • writeToCard_CallsWaitForAnyCard
      Verifies that writeToCard() invokes waitForAnyCard() on the underlying RfidComponent.
    • readFromCard_CallsWaitForAnyCard
      Verifies that readFromCard() invokes waitForAnyCard() on the RfidComponent.
    • resetScanner_CallsReset
      Ensures resetScanner() calls the reset() method on the RfidComponent.

all tests pass and the project builds successfully

@ThomasPautler952194 ThomasPautler952194 linked an issue Nov 11, 2025 that may be closed by this pull request
9 tasks
@ThomasPautler952194
ThomasPautler952194 marked this pull request as ready for review November 11, 2025 18:22

@leandrumartin leandrumartin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look good so far, but I think at least one more should be added. We don't want just to test that the read/write operations are called, but also that they are successful and read/write the info correctly. So it would be helpful to include a test that writes an object (something simple like an Integer) out, reads it, and sees whether the result is the same as what was initially sent out.

@leandrumartin
leandrumartin merged commit fb36baf into develop Nov 17, 2025
7 checks passed
@leandrumartin
leandrumartin deleted the 359-write-unit-tests-for-rfidhelper branch November 17, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write unit tests for RFidHelper

2 participants