### Question:
MvcConfig { @Bean public SpringTemplateEngine templateEngine(SpringResourceTemplateResolver templateResolver) { SpringTemplateEngine templateEngine = new SpringTemplateEngine(); templateEngine.setTemplateResolver(templateResolver); templateEngine.setEnableSpringELCompiler(true); templateEngine.addDialect(new Java8TimeDialect()); templateEngine.addDialect(new SpringSecurityDialect()); return templateEngine; }  @Bean SpringResourceTemplateResolver templateResolver(); @Bean SpringTemplateEngine templateEngine(SpringResourceTemplateResolver templateResolver); @Bean ThymeleafViewResolver viewResolver(SpringTemplateEngine templateEngine); @Bean MessageSource messageSource();  }### Answer:
@Test @DisplayName("templateEngineのBeanが定義されている") public void templateEngineTest() { Method templateEngineMethod = assertDoesNotThrow(() -> MvcConfig.class.getMethod("templateEngine", SpringResourceTemplateResolver.class)); Bean bean = templateEngineMethod.getAnnotation(Bean.class); assertNotNull(bean); SpringResourceTemplateResolver templateResolver = mvcConfig.templateResolver(); SpringTemplateEngine templateEngine = mvcConfig.templateEngine(templateResolver); Set<ITemplateResolver> templateResolvers = templateEngine.getTemplateResolvers(); String[] actualDialects = templateEngine.getDialects() .stream() .map(dialect -> dialect.getClass().getSimpleName()) .sorted() .toArray(String[]::new); assertAll("templateEngine not configured correctly", () -> assertTrue(templateResolvers.contains(templateResolver)), () -> assertTrue(templateEngine.getEnableSpringELCompiler()), () -> assertArrayEquals( new String[]{"Java8TimeDialect", "SpringSecurityDialect", "SpringStandardDialect"}, actualDialects) ); }