You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Write unit tests for the RGBLEDHelper class to ensure proper functionality of all its methods, including color setting, frequency handling, and turning the LED on/off. Use mocks for the Pwm components to simulate hardware interaction.
Tasks:
Test Initialization:
Verify that RGBLEDHelper correctly initializes Pwm instances for red, green, and blue.
Test setColor Methods:
Test setColor(int[] colors) to ensure it sets the RGB values with default frequency (200 Hz).
Test setColor(int[] colors, int[] frequency) to verify RGB values and corresponding frequencies are set properly.
Test setColorHex Methods:
Test setColorHex(String hex) for correct RGB values from hex and default frequency.
Test setColorHex(String hex, int[] frequency) for correct RGB values and frequencies.
Test Individual Color Setters:
Write tests for setRed, setGreen, and setBlue to validate both color value and frequency setting.
Test ledOff and ledOn:
Ensure ledOff() turns off all RGB components.
Ensure ledOn() sets all RGB values to 100 with default frequency.
Acceptance Criteria:
Unit tests cover all methods.
All tests pass with mock Pwm components.
Log messages are validated for correct execution.
The text was updated successfully, but these errors were encountered:
Hello dear @yrlmanoharreddy
I have some question about this issue:
If you want to verify RGBLEDHelper correctly initializes Pwm instances for red, green and blue, we need to having access to red, green and blue instances of class however we don't have any getter method for this fields. I can get access to this fields through reflection however it is not best way and also I can create getter methods for this fields. which one do you prefer or is there any other way ?
Same issue for checking log message. I need at least a setter method for logger field in order to check message through mocking logger. Can I add setter method to this class?
Description:
Write unit tests for the RGBLEDHelper class to ensure proper functionality of all its methods, including color setting, frequency handling, and turning the LED on/off. Use mocks for the Pwm components to simulate hardware interaction.
Tasks:
Test Initialization:
Verify that RGBLEDHelper correctly initializes Pwm instances for red, green, and blue.
Test setColor Methods:
Test setColor(int[] colors) to ensure it sets the RGB values with default frequency (200 Hz).
Test setColor(int[] colors, int[] frequency) to verify RGB values and corresponding frequencies are set properly.
Test setColorHex Methods:
Test setColorHex(String hex) for correct RGB values from hex and default frequency.
Test setColorHex(String hex, int[] frequency) for correct RGB values and frequencies.
Test Individual Color Setters:
Write tests for setRed, setGreen, and setBlue to validate both color value and frequency setting.
Test ledOff and ledOn:
Ensure ledOff() turns off all RGB components.
Ensure ledOn() sets all RGB values to 100 with default frequency.
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: