Home / Class/ OriginLookupTests Class — spring-boot Architecture

OriginLookupTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/origin/OriginLookupTests.java lines 31–61

class OriginLookupTests {

	@Test
	void getOriginWhenSourceIsNullShouldReturnNull() {
		assertThat(OriginLookup.getOrigin(null, "foo")).isNull();
	}

	@Test
	void getOriginWhenSourceIsNotLookupShouldReturnLookupOrigin() {
		Object source = new Object();
		assertThat(OriginLookup.getOrigin(source, "foo")).isNull();
	}

	@Test
	@SuppressWarnings("unchecked")
	void getOriginWhenSourceIsLookupShouldReturnLookupOrigin() {
		OriginLookup<String> source = mock(OriginLookup.class);
		Origin origin = MockOrigin.of("bar");
		given(source.getOrigin("foo")).willReturn(origin);
		assertThat(OriginLookup.getOrigin(source, "foo")).isEqualTo(origin);
	}

	@Test
	@SuppressWarnings("unchecked")
	void getOriginWhenSourceLookupThrowsAndErrorShouldReturnNull() {
		OriginLookup<String> source = mock(OriginLookup.class);
		willThrow(RuntimeException.class).given(source).getOrigin("foo");
		assertThat(OriginLookup.getOrigin(source, "foo")).isNull();
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free