Browse Source

Address review comments: rename test config class and drop inline FQN annotations

pull/15910/head
Viacheslav Klimov 4 weeks ago
parent
commit
c0dead8552
Failed to extract signature
  1. 10
      application/src/test/java/org/thingsboard/server/service/device/provision/DeviceProvisionServiceTest.java
  2. 3
      application/src/test/java/org/thingsboard/server/service/queue/DefaultTbClusterServiceTest.java
  3. 10
      application/src/test/java/org/thingsboard/server/service/transport/DefaultTransportApiServiceTest.java

10
application/src/test/java/org/thingsboard/server/service/device/provision/DeviceProvisionServiceTest.java

@ -21,6 +21,8 @@ import org.assertj.core.api.Assertions;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -73,12 +75,12 @@ import static org.mockito.Mockito.when;
@Slf4j @Slf4j
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(classes = DeviceProvisionServiceTest.ContextConfiguration.class) @ContextConfiguration(classes = DeviceProvisionServiceTest.TestConfig.class)
public class DeviceProvisionServiceTest { public class DeviceProvisionServiceTest {
@org.springframework.context.annotation.Configuration @Configuration
static class ContextConfiguration { static class TestConfig {
@org.springframework.context.annotation.Bean @Bean
public DeviceProvisionServiceImpl deviceProvisionService(TbQueueProducerProvider producerProvider, public DeviceProvisionServiceImpl deviceProvisionService(TbQueueProducerProvider producerProvider,
DeviceProfileService deviceProfileService, DeviceProfileService deviceProfileService,
DeviceService deviceService, DeviceService deviceService,

3
application/src/test/java/org/thingsboard/server/service/queue/DefaultTbClusterServiceTest.java

@ -17,6 +17,7 @@ package org.thingsboard.server.service.queue;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -115,7 +116,7 @@ public class DefaultTbClusterServiceTest {
@MockitoSpyBean @MockitoSpyBean
protected TbClusterService clusterService; protected TbClusterService clusterService;
@org.junit.Before @Before
public void setUp() { public void setUp() {
lenient().when(topicService.getNotificationsTopic(any(), any())).thenAnswer(invocation -> { lenient().when(topicService.getNotificationsTopic(any(), any())).thenAnswer(invocation -> {
ServiceType serviceType = invocation.getArgument(0); ServiceType serviceType = invocation.getArgument(0);

10
application/src/test/java/org/thingsboard/server/service/transport/DefaultTransportApiServiceTest.java

@ -20,6 +20,8 @@ import lombok.extern.slf4j.Slf4j;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; 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.MockitoBean;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
@ -69,12 +71,12 @@ import static org.mockito.Mockito.when;
@Slf4j @Slf4j
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ContextConfiguration(classes = DefaultTransportApiServiceTest.ContextConfiguration.class) @ContextConfiguration(classes = DefaultTransportApiServiceTest.TestConfig.class)
public class DefaultTransportApiServiceTest { public class DefaultTransportApiServiceTest {
@org.springframework.context.annotation.Configuration @Configuration
static class ContextConfiguration { static class TestConfig {
@org.springframework.context.annotation.Bean @Bean
public DefaultTransportApiService defaultTransportApiService(TbDeviceProfileCache deviceProfileCache, public DefaultTransportApiService defaultTransportApiService(TbDeviceProfileCache deviceProfileCache,
TbTenantProfileCache tenantProfileCache, TbTenantProfileCache tenantProfileCache,
TbApiUsageStateService apiUsageStateService, TbApiUsageStateService apiUsageStateService,

Loading…
Cancel
Save