报错
This commit is contained in:
parent
07e0303067
commit
4a4629c8bb
@ -5,6 +5,7 @@ import com.company.agentfoundation.ngp.performance.NgpDailyStoreTotal;
|
|||||||
import com.company.agentfoundation.ngp.performance.NgpPerformanceCacheRepository;
|
import com.company.agentfoundation.ngp.performance.NgpPerformanceCacheRepository;
|
||||||
import com.company.agentfoundation.ngp.performance.NgpPerformanceDayLoader;
|
import com.company.agentfoundation.ngp.performance.NgpPerformanceDayLoader;
|
||||||
import com.company.agentfoundation.ngp.performance.NgpPerformanceRefreshCoordinator;
|
import com.company.agentfoundation.ngp.performance.NgpPerformanceRefreshCoordinator;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -39,6 +40,7 @@ public class NgpMonthlyWeeklyService {
|
|||||||
private final FoundationProperties.Ngp config;
|
private final FoundationProperties.Ngp config;
|
||||||
private final Clock clock;
|
private final Clock clock;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
public NgpMonthlyWeeklyService(
|
public NgpMonthlyWeeklyService(
|
||||||
NgpPerformanceCacheRepository repository,
|
NgpPerformanceCacheRepository repository,
|
||||||
NgpPerformanceRefreshCoordinator refreshCoordinator,
|
NgpPerformanceRefreshCoordinator refreshCoordinator,
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.company.agentfoundation.ngp.performance.NgpPerformanceRefreshCoordina
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||||
|
|
||||||
import java.time.Clock;
|
import java.time.Clock;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -120,4 +121,17 @@ class NgpMonthlyWeeklyServiceTest {
|
|||||||
.containsExactly("网点A", "网点B", "网点C");
|
.containsExactly("网点A", "网点B", "网点C");
|
||||||
assertThat(all.grandTotal()).isEqualByComparingTo("600.00");
|
assertThat(all.grandTotal()).isEqualByComparingTo("600.00");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void springCanCreateServiceWhenTestClockConstructorAlsoExists() {
|
||||||
|
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
|
||||||
|
context.registerBean(NgpPerformanceCacheRepository.class, () -> mock(NgpPerformanceCacheRepository.class));
|
||||||
|
context.registerBean(NgpPerformanceRefreshCoordinator.class, () -> mock(NgpPerformanceRefreshCoordinator.class));
|
||||||
|
context.registerBean(FoundationProperties.class, FoundationProperties::new);
|
||||||
|
context.register(NgpMonthlyWeeklyService.class);
|
||||||
|
context.refresh();
|
||||||
|
|
||||||
|
assertThat(context.getBean(NgpMonthlyWeeklyService.class)).isNotNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user