Source:
public void setup() { initMocks(this); Map<String, String> props1 = new HashMap<>(); props1.put(Thing.PROPERTY_FIRMWARE_VERSION, V111); props1.put(Thing.PROPERTY_MODEL_ID, MODEL1); props1.put(Thing.PROPERTY_VENDOR, VENDOR1); thing1 = ThingBuilder.create(THING_TYPE_UID1, THING1_ID).withProperties(props1).build(); Map<String, String> props2 = new HashMap<>(); props2.put(Thing.PROPERTY_FIRMWARE_VERSION, V112); props2.put(Thing.PROPERTY_MODEL_ID, MODEL1); props2.put(Thing.PROPERTY_VENDOR, VENDOR1); thing2 = ThingBuilder.create(THING_TYPE_UID1, THING2_ID).withProperties(props2).build(); Map<String, String> props3 = new HashMap<>(); props3.put(Thing.PROPERTY_FIRMWARE_VERSION, VALPHA); props3.put(Thing.PROPERTY_MODEL_ID, MODEL2); props3.put(Thing.PROPERTY_VENDOR, VENDOR2); thing3 = ThingBuilder.create(THING_TYPE_UID2, THING3_ID).withProperties(props3).build(); firmwareUpdateService = new FirmwareUpdateServiceImpl(); safeCaller = getService(SafeCaller.class); assertNotNull(safeCaller); firmwareUpdateService.setSafeCaller(safeCaller); firmwareUpdateService.setFirmwareRegistry(mockFirmwareRegistry); handler1 = addHandler(thing1); handler2 = addHandler(thing2); handler3 = addHandler(thing3); firmwareUpdateService.setEventPublisher(mockPublisher); when(mockLocaleProvider.getLocale()).thenReturn(Locale.ENGLISH); firmwareUpdateService.setLocaleProvider(mockLocaleProvider); initialFirmwareRegistryMocking(); firmwareUpdateService.setTranslationProvider(mockTranslationProvider); firmwareUpdateService.setConfigDescriptionValidator(getService(ConfigDescriptionValidator.class)); }

Target:
public void setup() { initMocks(this); Map<String, String> props1 = new HashMap<>(); props1.put(Thing.PROPERTY_FIRMWARE_VERSION, V111); props1.put(Thing.PROPERTY_MODEL_ID, MODEL1); props1.put(Thing.PROPERTY_VENDOR, VENDOR1); thing1 = ThingBuilder.create(THING_TYPE_UID1, THING1_ID).withProperties(props1).build(); Map<String, String> props2 = new HashMap<>(); props2.put(Thing.PROPERTY_FIRMWARE_VERSION, V112); props2.put(Thing.PROPERTY_MODEL_ID, MODEL1); props2.put(Thing.PROPERTY_VENDOR, VENDOR1); thing2 = ThingBuilder.create(THING_TYPE_UID1, THING2_ID).withProperties(props2).build(); Map<String, String> props3 = new HashMap<>(); props3.put(Thing.PROPERTY_FIRMWARE_VERSION, VALPHA); props3.put(Thing.PROPERTY_MODEL_ID, MODEL2); props3.put(Thing.PROPERTY_VENDOR, VENDOR2); thing3 = ThingBuilder.create(THING_TYPE_UID2, THING3_ID).withProperties(props3).build(); firmwareUpdateService = new FirmwareUpdateServiceImpl(); SafeCaller safeCaller = getService(SafeCaller.class); assertNotNull(safeCaller); firmwareUpdateService.setSafeCaller(safeCaller); firmwareUpdateService.setFirmwareRegistry(mockFirmwareRegistry); handler1 = addHandler(thing1); handler2 = addHandler(thing2); handler3 = addHandler(thing3); firmwareUpdateService.setEventPublisher(mockPublisher); when(mockLocaleProvider.getLocale()).thenReturn(Locale.ENGLISH); firmwareUpdateService.setLocaleProvider(mockLocaleProvider); initialFirmwareRegistryMocking(); when(bundleResolver.resolveBundle(any())).thenReturn(mock(Bundle.class)); firmwareUpdateService.setBundleResolver(bundleResolver); firmwareUpdateService.setTranslationProvider(mockTranslationProvider); firmwareUpdateService.setConfigDescriptionValidator(mockConfigDescriptionValidator); }