Home / Class/ JsonStreamTests Class — spring-boot Architecture

JsonStreamTests Class — spring-boot Architecture

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

Entity Profile

Source Code

buildpack/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/json/JsonStreamTests.java lines 34–86

class JsonStreamTests extends AbstractJsonTests {

	private final JsonStream jsonStream;

	JsonStreamTests() {
		this.jsonStream = new JsonStream(getJsonMapper());
	}

	@Test
	void getWhenReadingObjectNodeReturnsNodes() throws Exception {
		List<ObjectNode> result = new ArrayList<>();
		this.jsonStream.get(getContent("stream.json"), result::add);
		assertThat(result).hasSize(595);
		assertThat(result.get(594).get("status").asString())
			.contains("Status: Downloaded newer image for paketo-buildpacks/cnb:base");
	}

	@Test
	void getWhenReadTypesReturnsTypes() throws Exception {
		List<TestEvent> result = new ArrayList<>();
		this.jsonStream.get(getContent("stream.json"), TestEvent.class, result::add);
		assertThat(result).hasSize(595);
		assertThat(result.get(1).getId()).isEqualTo("5667fdb72017");
		assertThat(result.get(594).getStatus())
			.isEqualTo("Status: Downloaded newer image for paketo-buildpacks/cnb:base");
	}

	/**
	 * Event for type deserialization tests.
	 */
	static class TestEvent {

		private final String id;

		private final String status;

		@JsonCreator
		TestEvent(String id, String status) {
			this.id = id;
			this.status = status;
		}

		String getId() {
			return this.id;
		}

		String getStatus() {
			return this.status;
		}

	}

}

Analyze Your Own Codebase

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

Try Supermodel Free