Home / Function/ mockHttpEntity() — spring-boot Function Reference

mockHttpEntity() — spring-boot Function Reference

Architecture documentation for the mockHttpEntity() function in AbstractHttpClientMockTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  18609c13_780f_967d_eb51_be6a1deef88f["mockHttpEntity()"]
  7a6e1e76_6c61_3e09_62a3_66b05b5870dd["mockSuccessfulMetadataGet()"]
  7a6e1e76_6c61_3e09_62a3_66b05b5870dd -->|calls| 18609c13_780f_967d_eb51_be6a1deef88f
  85552bae_8ab3_2fb8_e704_1e9bbf5a6bcb["mockSuccessfulProjectGeneration()"]
  85552bae_8ab3_2fb8_e704_1e9bbf5a6bcb -->|calls| 18609c13_780f_967d_eb51_be6a1deef88f
  713a8d8a_a9f2_ce1b_3af6_97ecfdb38d5f["mockProjectGenerationError()"]
  713a8d8a_a9f2_ce1b_3af6_97ecfdb38d5f -->|calls| 18609c13_780f_967d_eb51_be6a1deef88f
  9acc0f89_ebcd_60b7_0695_b84ba1cdf83b["mockMetadataGetError()"]
  9acc0f89_ebcd_60b7_0695_b84ba1cdf83b -->|calls| 18609c13_780f_967d_eb51_be6a1deef88f
  style 18609c13_780f_967d_eb51_be6a1deef88f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

cli/spring-boot-cli/src/test/java/org/springframework/boot/cli/command/init/AbstractHttpClientMockTests.java lines 111–124

	protected HttpEntity mockHttpEntity(ClassicHttpResponse response, byte[] content, @Nullable String contentType) {
		try {
			HttpEntity entity = mock(HttpEntity.class);
			given(entity.getContent()).willReturn(new ByteArrayInputStream(content));
			Header contentTypeHeader = (contentType != null) ? new BasicHeader("Content-Type", contentType) : null;
			given(entity.getContentType())
				.willReturn((contentTypeHeader != null) ? contentTypeHeader.getValue() : null);
			given(response.getEntity()).willReturn(entity);
			return entity;
		}
		catch (IOException ex) {
			throw new IllegalStateException("Should not happen", ex);
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does mockHttpEntity() do?
mockHttpEntity() is a function in the spring-boot codebase.
What calls mockHttpEntity()?
mockHttpEntity() is called by 4 function(s): mockMetadataGetError, mockProjectGenerationError, mockSuccessfulMetadataGet, mockSuccessfulProjectGeneration.

Analyze Your Own Codebase

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

Try Supermodel Free