Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
This PR addresses issue #507 to increase test coverage by adding unit tests for the methods in ColorRule Class under DataClass
The test description and results are given below.
Added Tests
givenColorRule_whenJsonRepresentationRequested_thenReturnMapOfAttributesToValues
The test sets the expected json map and asserts that the output of getJsonRepresentation() is the same as expected.givenColorRule_whenStringRequested_thenReturnStringOfAttributesToValuesAssignmentSeparatedByComma:
The test creates ColorRule, sets the expected string and asserts true for the toString() result.givenValidColorRuleInTableRow_whenRowSearched_thenReturnTrue:
This test cover checking if the entry of a row matches the ColorRule based on the ruleType.givenValidColorRuleInTableRow_whenRowSearched_andOperatorIsNoOp_orDiffElementTypeSpec_thenReturnFalse
This test covers cases where a false is expected from match result such as when the Element type is different or when the operator I not a valid operator.givenValidStringValue_whenGetEnumIsCalled_thenReturnCorrectRuleType:
Confirms that the RuleType returned from a String matches the correct ruleType.givenInvalidStringValue_whenGetEnumIsCalled_thenReturnCorrectRuleType
confirms an exception is thrown when an invalid string is supplied.givenColorRuleType_whenGetSymbolIsCalled_thenReturnCorrectSymbol:
Confirms that the symbol returned is correct.Result
This test has improved class coverage and method coverage to 100% and line coverage to 97% for the data class as shown below.
What is left to be done in the addressed issue?
Logging Class
DateUtil Class
What problems did you encounter?
In creating the test cases, I ran into the
Error: "Method ... not mocked"
for the alpha and rgb color formats for Color in android.graphics.