Conversation
wbrunette
left a comment
There was a problem hiding this comment.
There appears to be a lot of constant strings. It is better to list them as constants at the top and then use them to separate logic from declaration of constants.
For example EMPTY_STRING = "";
URL_SEGMENT1 = "test/"
|
Thank you for the feedback, I have made the changes. |
androidcommon_lib/src/test/java/org/opendatakit/test/UrlUtilsTest.java
Outdated
Show resolved
Hide resolved
| * @param segment URL segment to test | ||
| * @param expected Expected index of parameters | ||
| */ | ||
| protected void assertGetIndexHelper(String segment, int expected) { |
There was a problem hiding this comment.
If you change the package to org.opendatakit.webkitserver.utilities you should not need to use reflection.
There was a problem hiding this comment.
I tried this approach but encountered access errors. Even with the test in the same package name, I got the error: 'getIndexOfParameters(java.lang.String)' is not public in 'org.opendatakit.webkitserver.utilities.UrlUtils'. It cannot be accessed from outside the package.
I could add a public helper method in the UrlUtils class specifically for testing or use reflection. Please let me know if you'd like me to try a different approach for accessing the package-private method
There was a problem hiding this comment.
This conversation should not be resolved because it was not resolved. Also, generally, the person doing the review resolves when it's complete.
The package you changed it to is NOT the same:
org.opendatakit.webkitserver.utilities; vs org.opendatakit.test.webkitserver.utilities;
It needs to be exactly the same: org.opendatakit.webkitserver.utilities;
As stated in the review.
There was a problem hiding this comment.
Relocated UrlUtilsTest to match the package structure of the class under test. To allows access to package-private methods for more thorough testing.
androidcommon_lib/src/test/java/org/opendatakit/test/UrlUtilsTest.java
Outdated
Show resolved
Hide resolved
wbrunette
left a comment
There was a problem hiding this comment.
Suggestions form last code review not fixed.
A package-private function should be available to a class in the same package.
https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
wbrunette
left a comment
There was a problem hiding this comment.
You should not delete basictest
This PR addresses #523 which comes under utilities class
Added Test:
testNoHashOrParameters: Verifies file name extraction from a simple file path without parameterstestEmptyString: Checks handling of empty input stringtestOnlyHash: Tests retrieving file name from a URL with a hash fragmenttestOnlyQueryParams: Validates file name extraction from a URL with query parameterstestHashAndQueryParams: Ensures correct file name parsing from a URL with both hash and query parameterstestGetIndexOfParamsNoParams: Confirms parameter index detection for URL without parameterstestGetIndexOfParamsHash: Checks parameter index identification in a hash fragmenttestGetIndexOfQueryHash: Validates parameter index detection in query parameterstestGetIndexOfBoth: Verifies parameter index extraction from a URL with hash and query parameterstestGetParamsNone: Ensures no parameter extraction from a simple URLtestGetParamsHash: Tests parameter extraction from a URL with a hash fragmenttestGetParamsQuery: Validates parameter extraction from a URL with query parameterstestGetParamsBoth: Checks parameter extraction from a URL with both hash and query parametersResult: