|
@@ -9,11 +9,13 @@ import cn.yunzhixue.ability.center.examsprint.domain.report.ReportType;
|
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PlaywrightPdfWorker;
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PlaywrightPdfWorker;
|
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PlaywrightPdfWorkerFactory;
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PlaywrightPdfWorkerFactory;
|
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PooledPlaywrightExamSprintReportPdfGenerator;
|
|
import cn.yunzhixue.ability.center.examsprint.infrastructure.report.pdf.PooledPlaywrightExamSprintReportPdfGenerator;
|
|
|
|
|
+import cn.yunzhixue.ability.center.examsprint.infrastructure.report.rendering.outlook.ClasspathOutlookExamSprintReportRenderer;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+import org.springframework.context.annotation.Import;
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
import java.time.Duration;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
@@ -85,6 +87,16 @@ class ExamSprintReportRuntimeConfigurationTest {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void classpathOutlookExamSprintReportRendererIsAutowiredBySpringContext() {
|
|
|
|
|
+ new ApplicationContextRunner()
|
|
|
|
|
+ .withUserConfiguration(OutlookRendererConfiguration.class)
|
|
|
|
|
+ .run(context -> assertThat(context)
|
|
|
|
|
+ .hasBean("classpathOutlookExamSprintReportRenderer")
|
|
|
|
|
+ .hasSingleBean(ClasspathOutlookExamSprintReportRenderer.class)
|
|
|
|
|
+ .hasSingleBean(ExamSprintReportRenderer.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static PlaywrightPdfWorkerFactory fakePlaywrightPdfWorkerFactory() {
|
|
private static PlaywrightPdfWorkerFactory fakePlaywrightPdfWorkerFactory() {
|
|
|
return () -> new PlaywrightPdfWorker() {
|
|
return () -> new PlaywrightPdfWorker() {
|
|
|
@Override
|
|
@Override
|
|
@@ -121,4 +133,14 @@ class ExamSprintReportRuntimeConfigurationTest {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Configuration
|
|
|
|
|
+ @Import(ClasspathOutlookExamSprintReportRenderer.class)
|
|
|
|
|
+ static class OutlookRendererConfiguration {
|
|
|
|
|
+
|
|
|
|
|
+ @Bean
|
|
|
|
|
+ ObjectMapper objectMapper() {
|
|
|
|
|
+ return new ObjectMapper();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|