报错
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.NgpPerformanceDayLoader;
|
||||
import com.company.agentfoundation.ngp.performance.NgpPerformanceRefreshCoordinator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@ -39,6 +40,7 @@ public class NgpMonthlyWeeklyService {
|
||||
private final FoundationProperties.Ngp config;
|
||||
private final Clock clock;
|
||||
|
||||
@Autowired
|
||||
public NgpMonthlyWeeklyService(
|
||||
NgpPerformanceCacheRepository repository,
|
||||
NgpPerformanceRefreshCoordinator refreshCoordinator,
|
||||
|
||||
@ -7,6 +7,7 @@ import com.company.agentfoundation.ngp.performance.NgpPerformanceRefreshCoordina
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
@ -120,4 +121,17 @@ class NgpMonthlyWeeklyServiceTest {
|
||||
.containsExactly("网点A", "网点B", "网点C");
|
||||
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