Browse Source

Replaced deprecated @MockBean/@SpyBean with @MockitoBean in edqs and coap-server tests

Spring Boot 3.4 deprecated @MockBean/@SpyBean in favor of
@MockitoBean/@MockitoSpyBean.
pull/15487/head
Oleksandra Matviienko 5 months ago
parent
commit
decd71f48f
  1. 8
      common/coap-server/src/test/java/org/thingsboard/server/coapserver/TbCoapDtlsSettingsTest.java
  2. 4
      edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java

8
common/coap-server/src/test/java/org/thingsboard/server/coapserver/TbCoapDtlsSettingsTest.java

@ -18,7 +18,7 @@ package org.thingsboard.server.coapserver;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.TestPropertySource;
import org.thingsboard.server.common.transport.TransportService; import org.thingsboard.server.common.transport.TransportService;
import org.thingsboard.server.common.transport.config.ssl.SslCredentialsConfig; import org.thingsboard.server.common.transport.config.ssl.SslCredentialsConfig;
@ -41,11 +41,11 @@ class TbCoapDtlsSettingsTest {
@Autowired @Autowired
TbCoapDtlsSettings coapDtlsSettings; TbCoapDtlsSettings coapDtlsSettings;
@MockBean @MockitoBean
SslCredentialsConfig sslCredentialsConfig; SslCredentialsConfig sslCredentialsConfig;
@MockBean @MockitoBean
private TransportService transportService; private TransportService transportService;
@MockBean @MockitoBean
private TbServiceInfoProvider serviceInfoProvider; private TbServiceInfoProvider serviceInfoProvider;
@Test @Test

4
edqs/src/test/java/org/thingsboard/server/edqs/repo/AbstractEDQTest.java

@ -20,7 +20,7 @@ import org.junit.Before;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.TestExecutionListeners; import org.springframework.test.context.TestExecutionListeners;
@ -81,7 +81,7 @@ public abstract class AbstractEDQTest {
protected DefaultEdqsRepository repository; protected DefaultEdqsRepository repository;
@Autowired @Autowired
protected EdqsMapper edqsMapper; protected EdqsMapper edqsMapper;
@MockBean @MockitoBean
private DummyEdqsStatsService edqsStatsService; private DummyEdqsStatsService edqsStatsService;
protected final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID()); protected final TenantId tenantId = TenantId.fromUUID(UUID.randomUUID());

Loading…
Cancel
Save