Handle null arguments arriving as empty strings #53
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.
Null values arrive as empty strings due to the jrobotremoteserver conversion between java and python. This caused the ClassCastException in issue #46 where the result of the first find is null and that is given as a root parameter for the next find. Instead of null the keyword receives an empty string and the runKeyword call fails since it can't be cast as a Parent object.
Now there's an additional check for null values in useMappedObject which replaces empty string arguments with null. This means you won't be able to provide an empty string as an argument for the library, but there should be no keywords where this would be necessary.
I also want to point out that the usage of combined find keywords described in the issue #46 still won't behave as expected there. When the first find now returns null and that is given as a root argument for the next execution of find keyword, the library will use the default value (since root argument is null) and instead look for matches everywhere. In this case the first call to find should have failIfNotFound set as true so the test execution would already fail when the first node can't be found, or use chained queries (see Locator syntax in the keyword documentation).
Also added tests for invalid root arguments and a more descriptive exception message when the
java.lang.RuntimeException: java.lang.IllegalArgumentException: java.lang.ClassCastException@111abcde
is thrown. Closes #46.