[shelly] Add unit test coverage (#18794)
* Add coverage for BLU things * Use existing ThingTypeUID constants * Remove misplaced annotation Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>pull/18173/merge
parent
4a9af7110c
commit
9843c4ad8f
|
@ -48,8 +48,6 @@ import org.osgi.service.component.annotations.Reference;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.reactivex.annotations.NonNull;
|
||||
|
||||
/**
|
||||
* The {@link ShellyHandlerFactory} is responsible for creating things and thing handlers.
|
||||
*
|
||||
|
@ -156,7 +154,7 @@ public class ShellyHandlerFactory extends BaseThingHandlerFactory {
|
|||
* Remove handler of things.
|
||||
*/
|
||||
@Override
|
||||
protected synchronized void removeHandler(@NonNull ThingHandler thingHandler) {
|
||||
protected synchronized void removeHandler(ThingHandler thingHandler) {
|
||||
if (thingHandler instanceof ShellyBaseHandler shellyBaseHandler) {
|
||||
shellyBaseHandler.stop();
|
||||
String uid = thingHandler.getThing().getUID().getAsString();
|
||||
|
|
|
@ -202,16 +202,10 @@ public class ShellyThingCreatorTest {
|
|||
|
||||
@Test
|
||||
void getThingUIDReturnsThingTypeMatchingServiceName() {
|
||||
Set<ThingTypeUID> excludedThingTypeUids = Set.of(THING_TYPE_SHELLYBLUDW, THING_TYPE_SHELLYBLUMOTION,
|
||||
THING_TYPE_SHELLYBLUHT, THING_TYPE_SHELLYBLUGW, THING_TYPE_SHELLYBLUBUTTON, THING_TYPE_SHELLY2_RELAY,
|
||||
THING_TYPE_SHELLY2_ROLLER, THING_TYPE_SHELLY25_ROLLER, THING_TYPE_SHELLY25_RELAY,
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUSHTG3_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUS2PM_RELAY_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPLUS2PM_ROLLER_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPRO2_RELAY_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPRO2PM_ROLLER_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYPRO2PM_RELAY_STR),
|
||||
new ThingTypeUID(BINDING_ID, THING_TYPE_SHELLYRGBW2_COLOR_STR));
|
||||
Set<ThingTypeUID> excludedThingTypeUids = Set.of(THING_TYPE_SHELLY2_RELAY, THING_TYPE_SHELLY2_ROLLER,
|
||||
THING_TYPE_SHELLY25_ROLLER, THING_TYPE_SHELLY25_RELAY, THING_TYPE_SHELLYPLUSHTG3,
|
||||
THING_TYPE_SHELLYPLUS2PM_RELAY, THING_TYPE_SHELLYPLUS2PM_ROLLER, THING_TYPE_SHELLYPRO2_RELAY,
|
||||
THING_TYPE_SHELLYPRO2PM_ROLLER, THING_TYPE_SHELLYPRO2PM_RELAY, THING_TYPE_SHELLYRGBW2_COLOR);
|
||||
|
||||
for (ThingTypeUID supportedThingTypeUid : SUPPORTED_THING_TYPES_UIDS.stream()
|
||||
.filter(uid -> !excludedThingTypeUids.contains(uid)).toList()) {
|
||||
|
|
Loading…
Reference in New Issue