### Question:
MvcConfig { @Bean public MessageSource messageSource() { ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource(); messageSource.setDefaultEncoding(StandardCharsets.UTF_8.name()); return messageSource; }  @Bean SpringResourceTemplateResolver templateResolver(); @Bean SpringTemplateEngine templateEngine(SpringResourceTemplateResolver templateResolver); @Bean ThymeleafViewResolver viewResolver(SpringTemplateEngine templateEngine); @Bean MessageSource messageSource();  }### Answer:
@Test @DisplayName("messageSourceのBeanが定義されている") public void messageSourceTest() { Method messageSourceMethod = assertDoesNotThrow(() -> MvcConfig.class.getMethod("messageSource")); Bean bean = messageSourceMethod.getAnnotation(Bean.class); assertNotNull(bean); MessageSource messageSource = mvcConfig.messageSource(); assertTrue(messageSource instanceof ResourceBundleMessageSource); ResourceBundleMessageSource resourceBundleMessageSource = (ResourceBundleMessageSource) messageSource; assertAll("messageSource not configured correctly", () -> assertTrue(resourceBundleMessageSource.getBasenameSet().contains("messages")), () -> { Field defaultEncodingField = AbstractResourceBasedMessageSource.class.getDeclaredField("defaultEncoding"); defaultEncodingField.setAccessible(true); assertEquals(StandardCharsets.UTF_8.name(), defaultEncodingField.get(resourceBundleMessageSource)); } ); }