Home / Class/ MessageInterpolatorFactoryWithoutElIntegrationTests Class — spring-boot Architecture

MessageInterpolatorFactoryWithoutElIntegrationTests Class — spring-boot Architecture

Architecture documentation for the MessageInterpolatorFactoryWithoutElIntegrationTests class in MessageInterpolatorFactoryWithoutElIntegrationTests.java from the spring-boot codebase.

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/validation/MessageInterpolatorFactoryWithoutElIntegrationTests.java lines 38–66

@ClassPathExclusions("tomcat-embed-el-*.jar")
class MessageInterpolatorFactoryWithoutElIntegrationTests {

	@Test
	void defaultMessageInterpolatorShouldFail() {
		// Sanity test
		assertThatExceptionOfType(ValidationException.class)
			.isThrownBy(Validation.byDefaultProvider().configure()::getDefaultMessageInterpolator)
			.withMessageContaining("jakarta.el.ExpressionFactory");
	}

	@Test
	void getObjectShouldUseFallback() {
		MessageInterpolator interpolator = new MessageInterpolatorFactory().getObject();
		assertThat(interpolator).isInstanceOf(ParameterMessageInterpolator.class);
	}

	@Test
	void getObjectShouldUseMessageSourceMessageInterpolatorDelegateWithFallback() {
		MessageSource messageSource = mock(MessageSource.class);
		MessageInterpolatorFactory interpolatorFactory = new MessageInterpolatorFactory(messageSource);
		MessageInterpolator interpolator = interpolatorFactory.getObject();
		assertThat(interpolator).isInstanceOf(MessageSourceMessageInterpolator.class);
		assertThat(interpolator).hasFieldOrPropertyWithValue("messageSource", messageSource);
		assertThat(ReflectionTestUtils.getField(interpolator, "messageInterpolator"))
			.isInstanceOf(ParameterMessageInterpolator.class);
	}

}

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free