mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +01:00
Update Mockito, JUnit and use MockitoExtensions in itests (#2075)
* Updates Mockito to 3.7.0 * Updates JUnit to 5.7.0 * Use MockitoExtensions where possible Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
88253c8676
commit
64f444cf6e
@ -18,12 +18,12 @@
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.6.2</version>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-launcher</artifactId>
|
||||
<version>1.6.2</version>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
|
@ -34,22 +34,22 @@
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.6.2</version>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>5.6.2</version>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.4.6</version>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>3.4.6</version>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.thing.internal.profiles;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@ -27,12 +26,12 @@ import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.PercentType;
|
||||
@ -50,6 +49,7 @@ import org.openhab.core.types.UnDefType;
|
||||
*
|
||||
* @author Christoph Weitkamp - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SystemHysteresisStateProfileTest {
|
||||
|
||||
private static final String STRING_TEN = "10";
|
||||
@ -169,21 +169,9 @@ public class SystemHysteresisStateProfileTest {
|
||||
});
|
||||
}
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ProfileCallback mockCallback;
|
||||
private @Mock ProfileContext mockContext;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
mocksCloseable = openMocks(this);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrongParameterLower() {
|
||||
assertThrows(IllegalArgumentException.class, () -> initProfile(null, null));
|
||||
|
@ -15,7 +15,6 @@ Fragment-Host: org.openhab.core.auth.oauth2client
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
|
||||
@ -35,15 +34,7 @@ Fragment-Host: org.openhab.core.auth.oauth2client
|
||||
org.eclipse.jetty.websocket.common;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -54,4 +45,13 @@ Fragment-Host: org.openhab.core.auth.oauth2client
|
||||
org.openhab.core.auth.oauth2client.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.net;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -48,4 +43,9 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -48,4 +43,9 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.automation.module.script
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -49,4 +44,9 @@ Fragment-Host: org.openhab.core.automation.module.script
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -48,4 +43,9 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -48,4 +43,9 @@ Fragment-Host: org.openhab.core.automation
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -29,11 +29,6 @@ Fragment-Host: org.openhab.core.binding.xml
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
org.eclipse.jdt.annotation;version='[2.2.100,2.2.101)',\
|
||||
@ -47,4 +42,9 @@ Fragment-Host: org.openhab.core.binding.xml
|
||||
org.openhab.core.config.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.xml;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -14,7 +14,6 @@ Fragment-Host: org.openhab.core.config.core
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -30,15 +29,7 @@ Fragment-Host: org.openhab.core.config.core
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -47,4 +38,13 @@ Fragment-Host: org.openhab.core.config.core
|
||||
org.openhab.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.core.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -29,11 +29,6 @@ Fragment-Host: org.openhab.core.config.discovery.mdns
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -49,4 +44,9 @@ Fragment-Host: org.openhab.core.config.discovery.mdns
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.transport.mdns;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -16,7 +16,6 @@ Fragment-Host: org.openhab.core.config.discovery
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -32,15 +31,7 @@ Fragment-Host: org.openhab.core.config.discovery
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -55,4 +46,14 @@ Fragment-Host: org.openhab.core.config.discovery
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing.xml;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -25,7 +24,9 @@ import java.util.List;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.config.discovery.inbox.Inbox;
|
||||
import org.openhab.core.test.java.JavaOSGiTest;
|
||||
import org.openhab.core.thing.ThingRegistry;
|
||||
@ -48,6 +49,7 @@ import org.osgi.framework.ServiceRegistration;
|
||||
* @author Simon Kaufmann - added tests for ExtendedDiscoveryService, ported to Java
|
||||
* @author Andre Fuechsel - added tests for removeOlderResults for a specific bridge only
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String ANY_BINDING_ID_1 = "any2BindingId1";
|
||||
@ -81,14 +83,10 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
private ThingRegistry thingRegistry;
|
||||
private Inbox inbox;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock DiscoveryListener mockDiscoveryListener;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerVolatileStorageService();
|
||||
|
||||
thingRegistry = getService(ThingRegistry.class);
|
||||
@ -126,8 +124,6 @@ public class DiscoveryServiceRegistryOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
|
||||
discoveryServiceFaultyMock.abortScan();
|
||||
discoveryServiceMockForBinding1.abortScan();
|
||||
discoveryServiceMockForBinding2.abortScan();
|
||||
|
@ -17,7 +17,6 @@ Fragment-Host: org.openhab.core.config.discovery.usbserial.linuxsysfs
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.3,1.0.4)',\
|
||||
@ -30,15 +29,7 @@ Fragment-Host: org.openhab.core.config.discovery.usbserial.linuxsysfs
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -52,5 +43,15 @@ Fragment-Host: org.openhab.core.config.discovery.usbserial.linuxsysfs
|
||||
org.openhab.core.config.discovery.usbserial.linuxsysfs.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
||||
|
@ -14,7 +14,6 @@ package org.openhab.core.config.discovery.usbserial.linuxsysfs.internal;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
import static org.openhab.core.config.discovery.usbserial.linuxsysfs.internal.PollingUsbSerialScanner.PAUSE_BETWEEN_SCANS_IN_SECONDS_ATTRIBUTE;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -22,10 +21,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.config.discovery.usbserial.UsbSerialDeviceInformation;
|
||||
import org.openhab.core.config.discovery.usbserial.UsbSerialDiscoveryListener;
|
||||
import org.openhab.core.config.discovery.usbserial.linuxsysfs.testutil.UsbSerialDeviceInformationGenerator;
|
||||
@ -35,21 +37,19 @@ import org.openhab.core.config.discovery.usbserial.linuxsysfs.testutil.UsbSerial
|
||||
*
|
||||
* @author Henning Sudbrock - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class PollingUsbSerialScannerTest {
|
||||
|
||||
private UsbSerialDeviceInformationGenerator usbDeviceInfoGenerator = new UsbSerialDeviceInformationGenerator();
|
||||
|
||||
private PollingUsbSerialScanner pollingScanner;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock UsbSerialDiscoveryListener discoveryListenerMock;
|
||||
private @Mock UsbSerialScanner usbSerialScannerMock;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put(PAUSE_BETWEEN_SCANS_IN_SECONDS_ATTRIBUTE, "1");
|
||||
|
||||
@ -58,11 +58,6 @@ public class PollingUsbSerialScannerTest {
|
||||
pollingScanner.registerDiscoveryListener(discoveryListenerMock);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoScansWithoutBackgroundDiscovery() throws IOException, InterruptedException {
|
||||
// Wait a little more than one second to give background scanning a chance to kick in.
|
||||
|
@ -28,7 +28,6 @@ Provide-Capability: \
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
tec.uom.lib.uom-lib-common;version='[1.0.3,1.0.4)',\
|
||||
@ -40,15 +39,7 @@ Provide-Capability: \
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -61,4 +52,13 @@ Provide-Capability: \
|
||||
org.openhab.core.config.discovery.usbserial.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.io.console;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -29,11 +29,6 @@ Fragment-Host: org.openhab.core.config.dispatch
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -43,4 +38,9 @@ Fragment-Host: org.openhab.core.config.dispatch
|
||||
org.openhab.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.dispatch;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.dispatch.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.config.xml
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -44,4 +39,9 @@ Fragment-Host: org.openhab.core.config.xml
|
||||
org.openhab.core.config.xml;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.config.xml.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -42,11 +42,6 @@ feature.openhab-config: \
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
org.apache.felix.logback;version='[1.0.2,1.0.3)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -61,4 +56,9 @@ feature.openhab-config: \
|
||||
org.openhab.core.ephemeris;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.ephemeris.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -18,7 +18,6 @@ Fragment-Host: org.openhab.core.io.rest.core
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.objectweb.asm;version='[5.0.4,5.0.5)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -41,15 +40,7 @@ Fragment-Host: org.openhab.core.io.rest.core
|
||||
org.osgi.util.function;version='[1.1.0,1.1.1)',\
|
||||
org.osgi.util.promise;version='[1.1.0,1.1.1)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
org.apache.aries.jax.rs.whiteboard;version='[1.0.9,1.0.10)',\
|
||||
@ -76,4 +67,14 @@ Fragment-Host: org.openhab.core.io.rest.core
|
||||
org.openhab.core.persistence;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -15,15 +15,15 @@ package org.openhab.core.io.rest.core.internal.discovery;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.config.core.ConfigDescriptionRegistry;
|
||||
import org.openhab.core.config.discovery.inbox.Inbox;
|
||||
import org.openhab.core.test.java.JavaOSGiTest;
|
||||
@ -35,6 +35,7 @@ import org.openhab.core.thing.binding.builder.ThingBuilder;
|
||||
/**
|
||||
* @author Christoph Knauf - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class InboxResourceOSGITest extends JavaOSGiTest {
|
||||
|
||||
private InboxResource resource;
|
||||
@ -44,14 +45,10 @@ public class InboxResourceOSGITest extends JavaOSGiTest {
|
||||
private final Thing testThing = ThingBuilder.create(testTypeUID, testUID).build();
|
||||
private final String testThingLabel = "dummy_thing";
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock Inbox inbox;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
ConfigDescriptionRegistry configDescRegistry = getService(ConfigDescriptionRegistry.class);
|
||||
assertNotNull(configDescRegistry);
|
||||
|
||||
@ -60,11 +57,6 @@ public class InboxResourceOSGITest extends JavaOSGiTest {
|
||||
assertNotNull(resource);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assertThatApproveApprovesThingsWhichAreInTheInbox() {
|
||||
when(inbox.approve(any(), any(), any())).thenReturn(testThing);
|
||||
|
@ -19,7 +19,6 @@ import static org.hamcrest.core.IsIterableContaining.hasItems;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -35,10 +34,13 @@ import javax.ws.rs.core.Response.Status;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.io.rest.RESTResource;
|
||||
import org.openhab.core.items.GenericItem;
|
||||
import org.openhab.core.items.ItemProvider;
|
||||
@ -61,6 +63,8 @@ import com.jayway.jsonpath.JsonPath;
|
||||
/**
|
||||
* @author Henning Treu - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String ITEM_NAME1 = "Item1";
|
||||
@ -74,8 +78,6 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
private GenericItem item3;
|
||||
private GenericItem item4;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ItemProvider itemProvider;
|
||||
|
||||
private UriInfo uriInfo;
|
||||
@ -86,8 +88,6 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerService(new VolatileStorageService());
|
||||
|
||||
itemResource = getService(RESTResource.class, ItemResource.class);
|
||||
@ -113,11 +113,6 @@ public class ItemResourceOSGiTest extends JavaOSGiTest {
|
||||
when(httpHeaders.getHeaderString(anyString())).thenReturn(null);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnUnicodeItems() throws IOException {
|
||||
item4.setLabel(ITEM_LABEL4);
|
||||
|
@ -15,17 +15,17 @@ package org.openhab.core.io.rest.core.internal.persistence;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.i18n.TimeZoneProvider;
|
||||
import org.openhab.core.io.rest.LocaleService;
|
||||
import org.openhab.core.items.ItemRegistry;
|
||||
@ -42,6 +42,7 @@ import org.openhab.core.types.State;
|
||||
*
|
||||
* @author Stefan Triller - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class PersistenceResourceTest {
|
||||
|
||||
private static final String PERSISTENCE_SERVICE_ID = "TestServiceID";
|
||||
@ -49,8 +50,6 @@ public class PersistenceResourceTest {
|
||||
private PersistenceResource pResource;
|
||||
private List<HistoricItem> items;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ItemRegistry itemRegistry;
|
||||
private @Mock LocaleService localeService;
|
||||
private @Mock PersistenceServiceRegistry persistenceServiceRegistry;
|
||||
@ -58,8 +57,6 @@ public class PersistenceResourceTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
pResource = new PersistenceResource(itemRegistry, localeService, persistenceServiceRegistry, timeZoneProvider);
|
||||
|
||||
int startValue = 2016;
|
||||
@ -96,11 +93,6 @@ public class PersistenceResourceTest {
|
||||
when(timeZoneProvider.getTimeZone()).thenReturn(ZoneId.systemDefault());
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPersistenceItemData() {
|
||||
ItemHistoryDTO dto = pResource.createDTO(PERSISTENCE_SERVICE_ID, "testItem", null, null, 1, 5, false);
|
||||
|
@ -16,17 +16,19 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.io.rest.LocaleService;
|
||||
import org.openhab.core.test.java.JavaTest;
|
||||
import org.openhab.core.thing.profiles.ProfileType;
|
||||
@ -44,6 +46,8 @@ import org.openhab.core.thing.type.ChannelTypeUID;
|
||||
*
|
||||
* @author Stefan Triller - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class ProfileTypeResourceTest extends JavaTest {
|
||||
|
||||
private ProfileTypeResource resource;
|
||||
@ -71,16 +75,12 @@ public class ProfileTypeResourceTest extends JavaTest {
|
||||
private final ChannelType otherTriggerChannelType = ChannelTypeBuilder
|
||||
.trigger(otherTriggerChannelTypeUID, "channel1").build();
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ChannelTypeRegistry channelTypeRegistry;
|
||||
private @Mock LocaleService localeService;
|
||||
private @Mock ProfileTypeRegistry profileTypeRegistry;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
resource = new ProfileTypeResource(channelTypeRegistry, localeService, profileTypeRegistry);
|
||||
|
||||
List<ProfileType> profileTypes = new ArrayList<>();
|
||||
@ -104,11 +104,6 @@ public class ProfileTypeResourceTest extends JavaTest {
|
||||
when(channelTypeRegistry.getChannelType(otherTriggerChannelTypeUID, null)).thenReturn(otherTriggerChannelType);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAll() {
|
||||
Stream<ProfileTypeDTO> result = resource.getProfileTypes(null, null, null);
|
||||
|
@ -15,14 +15,14 @@ package org.openhab.core.io.rest.core.item;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.library.items.NumberItem;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
import org.openhab.core.service.StateDescriptionService;
|
||||
@ -34,29 +34,21 @@ import org.openhab.core.types.StateOption;
|
||||
/**
|
||||
* @author Henning Treu - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class EnrichedItemDTOMapperWithTransformOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String ITEM_NAME = "Item1";
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock StateDescriptionService stateDescriptionService;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
StateDescription stateDescription = StateDescriptionFragmentBuilder.create().withMinimum(BigDecimal.ZERO)
|
||||
.withMaximum(BigDecimal.valueOf(100)).withStep(BigDecimal.TEN).withPattern("%d °C").withReadOnly(true)
|
||||
.withOption(new StateOption("SOUND", "My great sound.")).build().toStateDescription();
|
||||
when(stateDescriptionService.getStateDescription(ITEM_NAME, null)).thenReturn(stateDescription);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldConsiderTraformationWhenPresent() {
|
||||
NumberItem item1 = new NumberItem("Item1");
|
||||
|
@ -22,7 +22,6 @@ Fragment-Host: org.openhab.core.model.core
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
com.google.gson;version='[2.8.2,2.8.3)',\
|
||||
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
@ -44,15 +43,7 @@ Fragment-Host: org.openhab.core.model.core
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -102,4 +93,15 @@ Fragment-Host: org.openhab.core.model.core
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.model.sitemap.runtime;version='[3.1.0,3.1.1)'
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.model.core.internal.folder;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -37,7 +36,9 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.OpenHAB;
|
||||
import org.openhab.core.model.core.ModelParser;
|
||||
import org.openhab.core.model.core.ModelRepository;
|
||||
@ -69,6 +70,7 @@ import org.osgi.service.component.ComponentContext;
|
||||
* @author Stefan Triller - added hidden file test
|
||||
* @author Simon Kaufmann - ported to Java
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class FolderObserverTest extends JavaOSGiTest {
|
||||
|
||||
private static final boolean IS_OS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
|
||||
@ -88,27 +90,18 @@ public class FolderObserverTest extends JavaOSGiTest {
|
||||
private FolderObserver folderObserver;
|
||||
private ModelRepoDummy modelRepo;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ModelParser modelParser;
|
||||
private @Mock ReadyService readyService;
|
||||
private @Mock ComponentContext context;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
configProps = new Hashtable<>();
|
||||
|
||||
setupWatchedDirectory();
|
||||
setUpServices();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* The main configuration folder's path is saved in the defaultWatchedDir variable
|
||||
* in order to be restored after all the tests are finished.
|
||||
|
@ -45,11 +45,6 @@ Fragment-Host: org.openhab.core.model.item
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -101,4 +96,10 @@ Fragment-Host: org.openhab.core.model.item
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
org.openhab.core.model.sitemap.runtime;version='[3.1.0,3.1.1)'
|
||||
|
@ -50,11 +50,6 @@ Fragment-Host: org.openhab.core.model.rule.runtime
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -106,5 +101,11 @@ Fragment-Host: org.openhab.core.model.rule.runtime
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
org.openhab.core.model.sitemap.runtime;version='[3.1.0,3.1.1)'
|
||||
-runblacklist: bnd.identity;id='jakarta.activation-api'
|
||||
|
@ -45,11 +45,6 @@ Fragment-Host: org.openhab.core.model.script
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -100,5 +95,11 @@ Fragment-Host: org.openhab.core.model.script
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
org.openhab.core.model.sitemap.runtime;version='[3.1.0,3.1.1)'
|
||||
|
||||
|
@ -24,7 +24,6 @@ Fragment-Host: org.openhab.core.model.thing
|
||||
org.glassfish.hk2.external.aopalliance-repackaged;version='[2.4.0,2.4.1)',\
|
||||
org.glassfish.hk2.external.javax.inject;version='[2.4.0,2.4.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -48,16 +47,7 @@ Fragment-Host: org.openhab.core.model.thing
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-params;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -113,5 +103,17 @@ Fragment-Host: org.openhab.core.model.thing
|
||||
org.openhab.core.thing.xml;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.transform;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-params;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.model.sitemap.runtime;version='[3.1.0,3.1.1)'
|
||||
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.math.BigDecimal;
|
||||
@ -28,7 +27,9 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.registry.ProviderChangeListener;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
import org.openhab.core.items.ItemRegistry;
|
||||
@ -46,6 +47,7 @@ import org.openhab.core.thing.link.ItemChannelLinkRegistry;
|
||||
*
|
||||
* @author Simon Kaufmann - Initial contribution and API
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@NonNullByDefault
|
||||
public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
|
||||
@ -56,8 +58,6 @@ public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
private static final String CHANNEL = "test:test:test:test";
|
||||
private static final String LINK = ITEM + " -> " + CHANNEL;
|
||||
|
||||
private @NonNullByDefault({}) AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock @Nullable ProviderChangeListener<ItemChannelLink> listenerMock;
|
||||
|
||||
private @NonNullByDefault({}) ModelRepository modelRepository;
|
||||
@ -68,8 +68,6 @@ public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerVolatileStorageService();
|
||||
|
||||
thingRegistry = getService(ThingRegistry.class);
|
||||
@ -88,8 +86,6 @@ public class GenericItemChannelLinkProviderJavaTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
|
||||
modelRepository.removeModel(THINGS_TESTMODEL_NAME);
|
||||
modelRepository.removeModel(ITEMS_TESTMODEL_NAME);
|
||||
|
||||
|
@ -28,11 +28,6 @@ Fragment-Host: org.openhab.core.storage.json
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -43,4 +38,9 @@ Fragment-Host: org.openhab.core.storage.json
|
||||
org.openhab.core.config.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.storage.json;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.storage.json.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -13,7 +13,6 @@ Fragment-Host: org.openhab.core
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -29,20 +28,22 @@ Fragment-Host: org.openhab.core
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
org.apache.servicemix.specs.activation-api-1.2.1;version='[1.2.1,1.2.2)',\
|
||||
org.glassfish.hk2.osgi-resource-locator;version='[1.0.1,1.0.2)',\
|
||||
org.openhab.core;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.tests;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.tests;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.isA;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.lang.Thread.State;
|
||||
import java.lang.management.ManagementFactory;
|
||||
@ -41,7 +40,9 @@ import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInfo;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.QueueingThreadPoolExecutor;
|
||||
import org.openhab.core.test.java.JavaTest;
|
||||
import org.slf4j.Logger;
|
||||
@ -51,6 +52,7 @@ import org.slf4j.LoggerFactory;
|
||||
*
|
||||
* @author Simon Kaufmann - Initial contribution and API.
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SafeCallerImplTest extends JavaTest {
|
||||
|
||||
private static final int THREAD_POOL_SIZE = 3;
|
||||
@ -71,8 +73,6 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
private TestInfo testInfo;
|
||||
private final List<AssertingThread> threads = new LinkedList<>();
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock Runnable mockRunnable;
|
||||
private @Mock Runnable mockTimeoutHandler;
|
||||
private @Mock Consumer<Throwable> mockErrorHandler;
|
||||
@ -95,8 +95,6 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
public void setup(TestInfo testInfo) {
|
||||
this.testInfo = testInfo;
|
||||
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
scheduler = QueueingThreadPoolExecutor.createInstance(testInfo.getTestMethod().get().getName(),
|
||||
THREAD_POOL_SIZE);
|
||||
safeCaller = new SafeCallerImpl(null) {
|
||||
@ -112,8 +110,6 @@ public class SafeCallerImplTest extends JavaTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
|
||||
// ensure all "inner" assertion errors are heard
|
||||
joinAll();
|
||||
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.internal.events;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -24,8 +23,12 @@ import java.util.Set;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.events.Event;
|
||||
import org.openhab.core.events.EventFactory;
|
||||
import org.openhab.core.events.EventPublisher;
|
||||
@ -40,6 +43,8 @@ import org.osgi.framework.ServiceRegistration;
|
||||
* @author Stefan Bußweiler - Initial contribution
|
||||
* @author Simon Kaufmann - migrated from Groovy to Java
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String EVENT_TYPE_A = "EVENT_TYPE_A";
|
||||
@ -60,8 +65,6 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private EventPublisher eventPublisher;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock EventSubscriber subscriber1;
|
||||
private @Mock EventSubscriber subscriber2;
|
||||
private @Mock EventSubscriber subscriber3;
|
||||
@ -71,8 +74,6 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
eventPublisher = getService(EventPublisher.class);
|
||||
assertNotNull(eventPublisher);
|
||||
|
||||
@ -103,7 +104,6 @@ public class OSGiEventManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
for (ServiceRegistration<?> service : serviceRegistrations.values()) {
|
||||
service.unregister();
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
@ -30,11 +29,14 @@ import javax.measure.quantity.Dimensionless;
|
||||
import javax.measure.quantity.Pressure;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.events.Event;
|
||||
import org.openhab.core.events.EventFilter;
|
||||
import org.openhab.core.events.EventPublisher;
|
||||
@ -70,6 +72,8 @@ import tec.uom.se.unit.Units;
|
||||
/**
|
||||
* @author Stefan Triller - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class GroupItemOSGiTest extends JavaOSGiTest {
|
||||
|
||||
/** Time to sleep when a file is created/modified/deleted, so the event can be handled */
|
||||
@ -80,8 +84,6 @@ public class GroupItemOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private ItemRegistry itemRegistry;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock UnitProvider unitProvider;
|
||||
|
||||
private final GroupFunctionHelper groupFunctionHelper = new GroupFunctionHelper();
|
||||
@ -89,8 +91,6 @@ public class GroupItemOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerVolatileStorageService();
|
||||
publisher = event -> events.add(event);
|
||||
|
||||
@ -122,11 +122,6 @@ public class GroupItemOSGiTest extends JavaOSGiTest {
|
||||
itemStateConverter = new ItemStateConverterImpl(unitProvider);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testItemUpdateWithItemRegistry() {
|
||||
|
@ -20,18 +20,18 @@ import static org.hamcrest.core.IsIterableContaining.hasItem;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.InOrder;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.registry.RegistryChangeListener;
|
||||
import org.openhab.core.events.EventPublisher;
|
||||
import org.openhab.core.i18n.UnitProvider;
|
||||
@ -57,6 +57,7 @@ import org.openhab.core.test.storage.VolatileStorageService;
|
||||
* @author Kai Kreuzer - added tests for all items changed cases
|
||||
* @author Sebastian Janzen - added test for getItemsByTag
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@SuppressWarnings("null")
|
||||
public class ItemRegistryImplTest extends JavaTest {
|
||||
|
||||
@ -73,14 +74,10 @@ public class ItemRegistryImplTest extends JavaTest {
|
||||
private ItemRegistry itemRegistry;
|
||||
private ManagedItemProvider itemProvider;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock EventPublisher eventPublisher;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
ItemFactory coreItemFactory = new CoreItemFactory();
|
||||
|
||||
GenericItem cameraItem1 = new SwitchItem(CAMERA_ITEM_NAME1);
|
||||
@ -116,11 +113,6 @@ public class ItemRegistryImplTest extends JavaTest {
|
||||
};
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void assertGetItemsReturnsItemFromRegisteredItemProvider() {
|
||||
List<Item> items = new ArrayList<>(itemRegistry.getItems());
|
||||
|
@ -14,15 +14,15 @@ package org.openhab.core.items.events;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.events.Event;
|
||||
import org.openhab.core.events.EventFactory;
|
||||
import org.openhab.core.events.EventPublisher;
|
||||
@ -41,6 +41,7 @@ import org.openhab.core.test.java.JavaOSGiTest;
|
||||
*
|
||||
* @author Stefan Bußweiler - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class AbstractItemEventSubscriberOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String ITEM_NAME = "SomeItem";
|
||||
@ -48,15 +49,11 @@ public class AbstractItemEventSubscriberOSGiTest extends JavaOSGiTest {
|
||||
private ItemCommandEvent commandEvent;
|
||||
private ItemStateEvent updateEvent;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ItemProvider itemProvider;
|
||||
private @Mock MetadataProvider mockMetadataProvider;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
eventPublisher = getService(EventPublisher.class);
|
||||
assertNotNull(eventPublisher);
|
||||
|
||||
@ -81,11 +78,6 @@ public class AbstractItemEventSubscriberOSGiTest extends JavaOSGiTest {
|
||||
registerService(mockMetadataProvider);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReceive() {
|
||||
eventPublisher.post(ItemEventFactory.createCommandEvent(ITEM_NAME, OnOffType.ON));
|
||||
|
@ -17,7 +17,6 @@ Fragment-Host: org.openhab.core.thing
|
||||
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
|
||||
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
|
||||
org.eclipse.equinox.event;version='[1.4.300,1.4.301)',\
|
||||
org.objenesis;version='[2.6.0,2.6.1)',\
|
||||
org.osgi.service.event;version='[1.4.0,1.4.1)',\
|
||||
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
|
||||
slf4j.api;version='[1.7.25,1.7.26)',\
|
||||
@ -33,15 +32,7 @@ Fragment-Host: org.openhab.core.thing
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.13,1.10.14)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.13,1.10.14)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.mockito.mockito-core;version='[3.4.6,3.4.7)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
jakarta.xml.bind-api;version='[2.3.3,2.3.4)',\
|
||||
@ -55,4 +46,14 @@ Fragment-Host: org.openhab.core.thing
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing.tests;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing.xml;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)',\
|
||||
net.bytebuddy.byte-buddy;version='[1.10.19,1.10.20)',\
|
||||
net.bytebuddy.byte-buddy-agent;version='[1.10.19,1.10.20)',\
|
||||
org.mockito.junit-jupiter;version='[3.7.0,3.7.1)',\
|
||||
org.mockito.mockito-core;version='[3.7.0,3.7.1)',\
|
||||
org.objenesis;version='[3.1.0,3.1.1)'
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URI;
|
||||
@ -34,10 +33,14 @@ import org.hamcrest.CoreMatchers;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.openhab.core.common.registry.RegistryChangeListener;
|
||||
import org.openhab.core.config.core.ConfigDescription;
|
||||
@ -86,6 +89,8 @@ import org.osgi.service.component.ComponentContext;
|
||||
* @auther Thomas Höfer - Added config status tests
|
||||
* @author Wouter Born - Migrate tests from Groovy to Java
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
@SuppressWarnings("null")
|
||||
public class BindingBaseClassesOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@ -96,14 +101,10 @@ public class BindingBaseClassesOSGiTest extends JavaOSGiTest {
|
||||
private ManagedThingProvider managedThingProvider;
|
||||
private ThingRegistry thingRegistry;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ComponentContext componentContext;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerVolatileStorageService();
|
||||
managedThingProvider = getService(ManagedThingProvider.class);
|
||||
assertThat(managedThingProvider, is(notNullValue()));
|
||||
@ -114,8 +115,6 @@ public class BindingBaseClassesOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
|
||||
managedThingProvider.getAll().forEach(t -> managedThingProvider.remove(t.getUID()));
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.thing.internal;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@ -29,8 +28,10 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.registry.ProviderChangeListener;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
import org.openhab.core.items.Item;
|
||||
@ -82,14 +83,13 @@ import org.osgi.service.component.ComponentContext;
|
||||
*
|
||||
* @author Christoph Weitkamp - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@NonNullByDefault
|
||||
public class ChannelCommandDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String TEST_BUNDLE_NAME = "thingStatusInfoI18nTest.bundle";
|
||||
private static final ChannelTypeUID CHANNEL_TYPE_UID = new ChannelTypeUID("hue:dynamic");
|
||||
|
||||
private @NonNullByDefault({}) AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock @NonNullByDefault({}) ComponentContext componentContextMock;
|
||||
|
||||
private @NonNullByDefault({}) ItemRegistry itemRegistry;
|
||||
@ -99,8 +99,6 @@ public class ChannelCommandDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
Mockito.when(componentContextMock.getBundleContext()).thenReturn(bundleContext);
|
||||
|
||||
registerVolatileStorageService();
|
||||
@ -177,7 +175,6 @@ public class ChannelCommandDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
testBundle.uninstall();
|
||||
ManagedThingProvider managedThingProvider = getService(ManagedThingProvider.class);
|
||||
assertNotNull(managedThingProvider);
|
||||
|
@ -17,7 +17,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -33,7 +32,9 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.registry.RegistryChangeListener;
|
||||
import org.openhab.core.items.ManagedItemProvider;
|
||||
import org.openhab.core.library.CoreItemFactory;
|
||||
@ -67,6 +68,7 @@ import org.osgi.framework.Bundle;
|
||||
*
|
||||
* @author Wouter Born - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@NonNullByDefault
|
||||
public class ChannelLinkNotifierOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@ -76,8 +78,6 @@ public class ChannelLinkNotifierOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private int thingCount;
|
||||
|
||||
private @NonNullByDefault({}) AutoCloseable mocksCloseable;
|
||||
|
||||
private @NonNullByDefault({}) ItemChannelLinkRegistry itemChannelLinkRegistry;
|
||||
private @NonNullByDefault({}) ManagedItemChannelLinkProvider managedItemChannelLinkProvider;
|
||||
private @NonNullByDefault({}) ManagedItemProvider managedItemProvider;
|
||||
@ -143,8 +143,6 @@ public class ChannelLinkNotifierOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
registerVolatileStorageService();
|
||||
|
||||
itemChannelLinkRegistry = getService(ItemChannelLinkRegistry.class);
|
||||
@ -186,8 +184,6 @@ public class ChannelLinkNotifierOSGiTest extends JavaOSGiTest {
|
||||
managedThingProvider.getAll().forEach(thing -> managedThingProvider.remove(thing.getUID()));
|
||||
|
||||
thingCount = 0;
|
||||
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
private Thing addThing(@Nullable ThingStatus thingStatus) {
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.thing.internal;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
@ -29,8 +28,10 @@ import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.openhab.core.common.registry.ProviderChangeListener;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
import org.openhab.core.items.Item;
|
||||
@ -86,14 +87,13 @@ import org.osgi.service.component.ComponentContext;
|
||||
* @author Thomas Höfer - Thing type constructor modified because of thing properties introduction
|
||||
* @author Markus Rathgeb - Migrated from Groovy to plain Java
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@NonNullByDefault
|
||||
public class ChannelStateDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private static final String TEST_BUNDLE_NAME = "thingStatusInfoI18nTest.bundle";
|
||||
private static final ChannelTypeUID CHANNEL_TYPE_7_UID = new ChannelTypeUID("hue:num-dynamic");
|
||||
|
||||
private @NonNullByDefault({}) AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock @NonNullByDefault({}) ComponentContext componentContext;
|
||||
|
||||
private @NonNullByDefault({}) ItemRegistry itemRegistry;
|
||||
@ -103,8 +103,6 @@ public class ChannelStateDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() throws Exception {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
Mockito.when(componentContext.getBundleContext()).thenReturn(bundleContext);
|
||||
|
||||
registerVolatileStorageService();
|
||||
@ -206,7 +204,6 @@ public class ChannelStateDescriptionProviderOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
testBundle.uninstall();
|
||||
ManagedThingProvider managedThingProvider = getService(ManagedThingProvider.class);
|
||||
assertNotNull(managedThingProvider);
|
||||
|
@ -15,7 +15,6 @@ package org.openhab.core.thing.internal;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -25,11 +24,14 @@ import java.util.stream.Stream;
|
||||
import javax.measure.quantity.Temperature;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.common.SafeCaller;
|
||||
import org.openhab.core.common.registry.Provider;
|
||||
import org.openhab.core.common.registry.ProviderChangeListener;
|
||||
@ -85,6 +87,8 @@ import org.openhab.core.types.StateDescriptionFragmentBuilder;
|
||||
*
|
||||
* @author Simon Kaufmann - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
@NonNullByDefault
|
||||
public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@ -134,8 +138,6 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
ChannelBuilder.create(TRIGGER_CHANNEL_UID_1).withKind(ChannelKind.TRIGGER).build(),
|
||||
ChannelBuilder.create(TRIGGER_CHANNEL_UID_2).withKind(ChannelKind.TRIGGER).build()).build();
|
||||
|
||||
private @NonNullByDefault({}) AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock @NonNullByDefault({}) AutoUpdateManager autoUpdateManagerMock;
|
||||
private @Mock @NonNullByDefault({}) ChannelTypeRegistry channelTypeRegistryMock;
|
||||
private @Mock @NonNullByDefault({}) EventPublisher eventPublisherMock;
|
||||
@ -156,8 +158,6 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
safeCaller = getService(SafeCaller.class);
|
||||
assertNotNull(safeCaller);
|
||||
|
||||
@ -233,11 +233,6 @@ public class CommunicationManagerOSGiTest extends JavaOSGiTest {
|
||||
ITEM_4.setUnitProvider(unitProvider);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStateUpdatedSingleLink() {
|
||||
manager.stateUpdated(STATE_CHANNEL_UID_1, OnOffType.ON);
|
||||
|
@ -19,7 +19,6 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
import static org.openhab.core.thing.firmware.Constants.*;
|
||||
import static org.openhab.core.thing.firmware.FirmwareStatusInfo.*;
|
||||
|
||||
@ -43,8 +42,12 @@ import java.util.stream.Stream;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.openhab.core.common.SafeCaller;
|
||||
import org.openhab.core.config.core.validation.ConfigDescriptionValidator;
|
||||
@ -79,6 +82,8 @@ import org.osgi.framework.Bundle;
|
||||
* @author Dimitar Ivanov - Added a test for valid cancel execution during firmware update; Replaced Firmware UID with
|
||||
* thing UID and firmware version
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
|
||||
public static final ProgressStep[] SEQUENCE = new ProgressStep[] { ProgressStep.REBOOTING, ProgressStep.DOWNLOADING,
|
||||
@ -90,8 +95,6 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
|
||||
private FirmwareUpdateServiceImpl firmwareUpdateService;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock FirmwareRegistry mockFirmwareRegistry;
|
||||
private @Mock FirmwareUpdateHandler handler1;
|
||||
private @Mock FirmwareUpdateHandler handler2;
|
||||
@ -104,8 +107,6 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
Map<String, String> props1 = new HashMap<>();
|
||||
props1.put(Thing.PROPERTY_FIRMWARE_VERSION, V111);
|
||||
props1.put(Thing.PROPERTY_MODEL_ID, MODEL1);
|
||||
@ -145,11 +146,6 @@ public class FirmwareUpdateServiceTest extends JavaOSGiTest {
|
||||
when(bundleResolver.resolveBundle(any())).thenReturn(mock(Bundle.class));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
private void initialFirmwareRegistryMocking() {
|
||||
when(mockFirmwareRegistry.getFirmware(eq(thing1), eq(V009))).thenReturn(FW009_EN);
|
||||
|
||||
|
@ -14,16 +14,18 @@ package org.openhab.core.thing.internal.profiles;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.MockitoAnnotations.openMocks;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.openhab.core.config.core.Configuration;
|
||||
import org.openhab.core.library.CoreItemFactory;
|
||||
import org.openhab.core.test.java.JavaOSGiTest;
|
||||
@ -43,6 +45,8 @@ import org.openhab.core.thing.type.ChannelType;
|
||||
*
|
||||
* @author Simon Kaufmann - Initial contribution
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.WARN)
|
||||
public class SystemProfileFactoryOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private final Map<String, Object> properties = Map.of(SystemOffsetProfile.OFFSET_PARAM, BigDecimal.ZERO,
|
||||
@ -50,26 +54,17 @@ public class SystemProfileFactoryOSGiTest extends JavaOSGiTest {
|
||||
|
||||
private SystemProfileFactory profileFactory;
|
||||
|
||||
private AutoCloseable mocksCloseable;
|
||||
|
||||
private @Mock ProfileCallback mockCallback;
|
||||
private @Mock ProfileContext mockContext;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
mocksCloseable = openMocks(this);
|
||||
|
||||
profileFactory = getService(ProfileTypeProvider.class, SystemProfileFactory.class);
|
||||
assertNotNull(profileFactory);
|
||||
|
||||
when(mockContext.getConfiguration()).thenReturn(new Configuration(properties));
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void afterEach() throws Exception {
|
||||
mocksCloseable.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void systemProfileTypesAndUidsShouldBeAvailable() {
|
||||
Collection<ProfileTypeUID> systemProfileTypeUIDs = profileFactory.getSupportedProfileTypeUIDs();
|
||||
|
@ -30,11 +30,6 @@ Fragment-Host: org.openhab.core.thing.xml
|
||||
org.eclipse.jetty.servlet;version='[9.4.20,9.4.21)',\
|
||||
org.eclipse.jetty.util;version='[9.4.20,9.4.21)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -50,4 +45,9 @@ Fragment-Host: org.openhab.core.thing.xml
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing.xml;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing.xml.tests;version='[3.1.0,3.1.1)',\
|
||||
xstream;version='[1.4.15,1.4.16)'
|
||||
xstream;version='[1.4.15,1.4.16)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
@ -31,12 +31,6 @@ Fragment-Host: org.openhab.core.voice
|
||||
org.eclipse.jetty.xml;version='[9.4.20,9.4.21)',\
|
||||
org.ops4j.pax.swissbox.optional.jcl;version='[1.8.3,1.8.4)',\
|
||||
biz.aQute.tester.junit-platform;version='[5.1.2,5.1.3)',\
|
||||
junit-jupiter-api;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-engine;version='[5.6.2,5.6.3)',\
|
||||
junit-jupiter-params;version='[5.6.2,5.6.3)',\
|
||||
junit-platform-commons;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-engine;version='[1.6.2,1.6.3)',\
|
||||
junit-platform-launcher;version='[1.6.2,1.6.3)',\
|
||||
org.hamcrest;version='[2.2.0,2.2.1)',\
|
||||
org.opentest4j;version='[1.2.0,1.2.1)',\
|
||||
com.sun.xml.bind.jaxb-osgi;version='[2.3.3,2.3.4)',\
|
||||
@ -60,4 +54,10 @@ Fragment-Host: org.openhab.core.voice
|
||||
org.openhab.core.test;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.thing;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice;version='[3.1.0,3.1.1)',\
|
||||
org.openhab.core.voice.tests;version='[3.1.0,3.1.1)'
|
||||
org.openhab.core.voice.tests;version='[3.1.0,3.1.1)',\
|
||||
junit-jupiter-api;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-engine;version='[5.7.0,5.7.1)',\
|
||||
junit-jupiter-params;version='[5.7.0,5.7.1)',\
|
||||
junit-platform-commons;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-engine;version='[1.7.0,1.7.1)',\
|
||||
junit-platform-launcher;version='[1.7.0,1.7.1)'
|
||||
|
Loading…
Reference in New Issue
Block a user