-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SLUB: Get Results by Id for Lent and Reserved Items (#598)
* SLUB: Put prefix "id" before id identifier to prepare for different kinds of identifiers * SLUB: Test for getResultById This test is not ideal as the test should just verify that parseResultById will be called with correct id but not actually call it. So it should be Mockito.doReturn(DetailedItem()).`when`(slub).parseResultById(Matchers.any(), Matchers.any()) ... verify(slub).parseResultById("id/123", JSONObject(response)) but this throws an IllegalStateException: Mockito.any() must not be null because of the not nullable Kotlin function signature of parseResultById. None of the solutions from https://stackoverflow.com/questions/30305217/is-it-possible-to-use-mockito-in-kotlin work. See also mockito/mockito#1255. The only possible solution seems to be switching to MockK. * SLUB: Get actual id from JSON instead of using id passed in as argument to call of getResultById and hence parseResultById as the actual identifier obtained in the process may differ from the one used to call the method. * SLUB: make getResultById work for bc identifiers Get id identifier from bc identifier by intercepting redirect from bc to id. This requires to unset client's followRedirections property by building a new client based on the client of OkHttpBaseApi. * SLUB: test code cleanup - remove empty primary constructor - remove redundant qualifier name - optimize imports * SLUB: fallback in getResultById for legacy id identifiers without prefix which could result from items added to favorites list before commit 31d6006. Also add final '/' to identifier when checking (in case a legacy identifier starts with the characters 'id' which are not a prefix in this case). Make implicit support for 'rsn' identifiers (currently not used) explicit.
- Loading branch information
Showing
3 changed files
with
233 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.