Browse Source
Address review comments: rename test config class and drop inline FQN annotations
pull/15910/head
Viacheslav Klimov
2 weeks ago
Failed to extract signature
3 changed files with
14 additions and
9 deletions
-
application/src/test/java/org/thingsboard/server/service/device/provision/DeviceProvisionServiceTest.java
-
application/src/test/java/org/thingsboard/server/service/queue/DefaultTbClusterServiceTest.java
-
application/src/test/java/org/thingsboard/server/service/transport/DefaultTransportApiServiceTest.java
|
|
|
@ -21,6 +21,8 @@ import org.assertj.core.api.Assertions; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.test.context.bean.override.mockito.MockitoBean; |
|
|
|
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; |
|
|
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
@ -73,12 +75,12 @@ import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@RunWith(SpringRunner.class) |
|
|
|
@ContextConfiguration(classes = DeviceProvisionServiceTest.ContextConfiguration.class) |
|
|
|
@ContextConfiguration(classes = DeviceProvisionServiceTest.TestConfig.class) |
|
|
|
public class DeviceProvisionServiceTest { |
|
|
|
|
|
|
|
@org.springframework.context.annotation.Configuration |
|
|
|
static class ContextConfiguration { |
|
|
|
@org.springframework.context.annotation.Bean |
|
|
|
@Configuration |
|
|
|
static class TestConfig { |
|
|
|
@Bean |
|
|
|
public DeviceProvisionServiceImpl deviceProvisionService(TbQueueProducerProvider producerProvider, |
|
|
|
DeviceProfileService deviceProfileService, |
|
|
|
DeviceService deviceService, |
|
|
|
|
|
|
|
@ -17,6 +17,7 @@ package org.thingsboard.server.service.queue; |
|
|
|
|
|
|
|
import com.google.common.collect.Sets; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.mockito.ArgumentCaptor; |
|
|
|
@ -115,7 +116,7 @@ public class DefaultTbClusterServiceTest { |
|
|
|
@MockitoSpyBean |
|
|
|
protected TbClusterService clusterService; |
|
|
|
|
|
|
|
@org.junit.Before |
|
|
|
@Before |
|
|
|
public void setUp() { |
|
|
|
lenient().when(topicService.getNotificationsTopic(any(), any())).thenAnswer(invocation -> { |
|
|
|
ServiceType serviceType = invocation.getArgument(0); |
|
|
|
|
|
|
|
@ -20,6 +20,8 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.junit.Before; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.runner.RunWith; |
|
|
|
import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Configuration; |
|
|
|
import org.springframework.test.context.bean.override.mockito.MockitoBean; |
|
|
|
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; |
|
|
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
@ -69,12 +71,12 @@ import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@RunWith(SpringRunner.class) |
|
|
|
@ContextConfiguration(classes = DefaultTransportApiServiceTest.ContextConfiguration.class) |
|
|
|
@ContextConfiguration(classes = DefaultTransportApiServiceTest.TestConfig.class) |
|
|
|
public class DefaultTransportApiServiceTest { |
|
|
|
|
|
|
|
@org.springframework.context.annotation.Configuration |
|
|
|
static class ContextConfiguration { |
|
|
|
@org.springframework.context.annotation.Bean |
|
|
|
@Configuration |
|
|
|
static class TestConfig { |
|
|
|
@Bean |
|
|
|
public DefaultTransportApiService defaultTransportApiService(TbDeviceProfileCache deviceProfileCache, |
|
|
|
TbTenantProfileCache tenantProfileCache, |
|
|
|
TbApiUsageStateService apiUsageStateService, |
|
|
|
|