Home / Class/ IgnoreErrorsBindHandlerTests Class — spring-boot Architecture

IgnoreErrorsBindHandlerTests Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

core/spring-boot/src/test/java/org/springframework/boot/context/properties/bind/handler/IgnoreErrorsBindHandlerTests.java lines 40–80

class IgnoreErrorsBindHandlerTests {

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

	private Binder binder;

	@BeforeEach
	void setup() {
		MockConfigurationPropertySource source = new MockConfigurationPropertySource();
		source.put("example.foo", "bar");
		this.sources.add(source);
		this.binder = new Binder(this.sources);
	}

	@Test
	void bindWhenNotIgnoringErrorsShouldFail() {
		assertThatExceptionOfType(BindException.class)
			.isThrownBy(() -> this.binder.bind("example", Bindable.of(Example.class)));
	}

	@Test
	void bindWhenIgnoringErrorsShouldBind() {
		Example bound = this.binder.bind("example", Bindable.of(Example.class), new IgnoreErrorsBindHandler()).get();
		assertThat(bound.getFoo()).isZero();
	}

	static class Example {

		private int foo;

		int getFoo() {
			return this.foo;
		}

		void setFoo(int foo) {
			this.foo = foo;
		}

	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free