Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ODK-X AndroidLibrary Test Coverage: Update Tests for Data Class #515

Open
2 tasks done
xadina02 opened this issue Oct 22, 2024 · 0 comments
Open
2 tasks done

Comments

@xadina02
Copy link

This issue highlights the need to write test cases for uncovered methods within the ColorRule class in the org.opendatakit.data suite.

This involves writing tests to cover the behavior and functionality of the following methods within the java class against all possible scenarios..

  • testGetJsonRepresentation: Returns a JSON representation of the color rule's key attributes (as a TreeMap), making it easy to serialize the rule for web APIs or storage.

  • testCheckMatch : This is the main logic that determines if the rule matches a given row of data

  • Retrieves the value from the row using the element key (mElementKey).

  • Compares the retrieved value against mValue based on the operator (mOperator).

  • If the data type is number or integer, it converts values to numbers for comparison.

  • Returns true if the rule condition matches the row's value, otherwise false.

  • Catches and logs NumberFormatException errors, in case a non-number is compared when a numeric comparison is expected.

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

No branches or pull requests

1 participant