Add AbstractThingHandlerDiscoveryService constructor for tests to use#5100
Merged
holgerfriedrich merged 1 commit intoopenhab:mainfrom Oct 26, 2025
Conversation
… a different executor, some JavaDocs, and made ThingHandler type generic Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
Contributor
Author
|
I've managed to restore all the tests using the PR: https://github.com/Nadahar/openhab-addons/tree/reenable-discovery-tests I haven't created a PR yet, because it will only fail to build without this one being merged, but it means that no further changes should be required in Core to make the tests work. |
Contributor
Author
|
For reference, this is a "continuation of"/related to #5072. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@holgerfriedrich Immediately when starting to try to fix the tests, I met one of the situations where I needed the ability to override
thingDiscovered(). This is the alternative I've been able to come up with for this particular problem, we need a corresponding "test constructor" inAbstractThingHandlerDiscoveryServiceas we have inAbstractDiscoveryService.As usual, I can't keep my fingers off other things I bump into, so I've added some JavaDoc to the constructors, and changed the return type of
getThingHandler(). If that's controversial, I can just revert it, but the reason I did it was that when trying to research how to document the parameter in the JavaDoc, I realized that it wasn't actually used for anything (except to enforce the type insetThingHandler()- which serves no purpose alone).As far as I can understand, this change will only trigger warnings for "unnecessary casts", so it shouldn't break anything. Not having to cast the result should at least make having the parameter there do something useful.