Home / Class/ PathFilterTests Class — spring-boot Architecture

PathFilterTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/json/JsonWriterTests.java lines 550–583

	@Nested
	class PathFilterTests {

		@Test
		void filteringMember() {
			JsonWriter<Person> writer = JsonWriter.of((members) -> {
				members.add("first", Person::firstName);
				members.add("last", Person::lastName);
				members.applyingPathFilter((path) -> {
					String name = path.name();
					assertThat(name).isNotNull();
					return name.equals("first");
				});
			});
			assertThat(writer.writeToString(new Person("spring", "boot", 10))).isEqualTo("""
					{"last":"boot"}""");
		}

		@Test
		void filteringInMap() {
			JsonWriter<Map<?, ?>> writer = JsonWriter.of((members) -> {
				members.add();
				members.applyingPathFilter((path) -> {
					String name = path.name();
					assertThat(name).isNotNull();
					return name.equals("spring");
				});

			});
			assertThat(writer.writeToString(Map.of("spring", "boot", "test", "test"))).isEqualTo("""
					{"test":"test"}""");
		}

	}

Analyze Your Own Codebase

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

Try Supermodel Free