Home / Class/ BoundPropertiesTrackingBindHandlerTests Class — spring-boot Architecture

BoundPropertiesTrackingBindHandlerTests Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/BoundPropertiesTrackingBindHandlerTests.java lines 42–83

@ExtendWith(MockitoExtension.class)
class BoundPropertiesTrackingBindHandlerTests {

	private final List<ConfigurationPropertySource> sources = new ArrayList<>();

	private BoundPropertiesTrackingBindHandler handler;

	private Binder binder;

	@Mock
	@SuppressWarnings("NullAway.Init")
	private Consumer<ConfigurationProperty> consumer;

	@BeforeEach
	void setup() {
		this.binder = new Binder(this.sources);
		this.handler = new BoundPropertiesTrackingBindHandler(this.consumer);
	}

	@Test
	void handlerShouldCallRecordBindingIfConfigurationPropertyIsNotNull() {
		this.sources.add(new MockConfigurationPropertySource("foo.age", 4));
		this.binder.bind("foo", Bindable.of(ExampleBean.class), this.handler);
		then(this.consumer).should().accept(any(ConfigurationProperty.class));
		then(this.consumer).should(never()).accept(null);
	}

	static class ExampleBean {

		private int age;

		int getAge() {
			return this.age;
		}

		void setAge(int age) {
			this.age = age;
		}

	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free