mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Fix test failures in DiscoveryServiceRegistryOSGiTest by resetting mock after cached result replay (#5307)
* Initial plan * Fix Mockito verification failures in DiscoveryServiceRegistryOSGiTest Add reset(discoveryListenerMock) after addDiscoveryListener() in both testRemoveOlderResultsOnlySameService() and testRemoveOlderResultsOnlyOfSpecificBridge() to clear the mock invocation counter after cached results are replayed. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: holgerfriedrich <2121139+holgerfriedrich@users.noreply.github.com>
This commit is contained in:
co-authored by
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
holgerfriedrich
parent
9a4193a89e
commit
73c65c5213
+2
@@ -256,6 +256,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
|
||||
discoveryServiceRegistry.addDiscoveryListener(discoveryListenerMock);
|
||||
reset(discoveryListenerMock); // Reset mock to ignore cached result replays
|
||||
discoveryServiceRegistry.startScan(new ThingTypeUID(ANY_BINDING_ID_1, ANY_THING_TYPE_1), null,
|
||||
mockScanListener1);
|
||||
|
||||
@@ -296,6 +297,7 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
ScanListener mockScanListener1 = mock(ScanListener.class);
|
||||
|
||||
discoveryServiceRegistry.addDiscoveryListener(discoveryListenerMock);
|
||||
reset(discoveryListenerMock); // Reset mock to ignore cached result replays
|
||||
discoveryServiceRegistry.startScan(ANY_BINDING_ID_3_ANY_THING_TYPE_3_UID, null, mockScanListener1);
|
||||
|
||||
waitForAssert(() -> verify(mockScanListener1, times(1)).onFinished());
|
||||
|
||||
Reference in New Issue
Block a user