Home / Class/ SslBundleTests Class — spring-boot Architecture

SslBundleTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/ssl/SslBundleTests.java lines 35–73

class SslBundleTests {

	@Test
	void createSslContextDelegatesToManagers() {
		SslManagerBundle managers = mock(SslManagerBundle.class);
		SslBundle bundle = SslBundle.of(null, null, null, "testprotocol", managers);
		bundle.createSslContext();
		then(managers).should().createSslContext("testprotocol");
	}

	@Test
	void ofCreatesSslBundle() {
		SslStoreBundle stores = mock(SslStoreBundle.class);
		SslBundleKey key = mock(SslBundleKey.class);
		SslOptions options = mock(SslOptions.class);
		String protocol = "test";
		SslManagerBundle managers = mock(SslManagerBundle.class);
		SslBundle bundle = SslBundle.of(stores, key, options, protocol, managers);
		assertThat(bundle.getStores()).isSameAs(stores);
		assertThat(bundle.getKey()).isSameAs(key);
		assertThat(bundle.getOptions()).isSameAs(options);
		assertThat(bundle.getProtocol()).isSameAs(protocol);
		assertThat(bundle.getManagers()).isSameAs(managers);
	}

	@Test
	void shouldCreateSystemDefaultBundle() {
		SslBundle sslBundle = SslBundle.systemDefault();
		SSLContext sslContext = sslBundle.createSslContext();
		assertThat(sslContext).isNotNull();
		TrustManager[] trustManagers = sslBundle.getManagers().getTrustManagers();
		assertThat(trustManagers).isNotEmpty();
		TrustManager trustManager = trustManagers[0];
		assertThat(trustManager).isInstanceOf(X509TrustManager.class);
		X509TrustManager x509TrustManager = (X509TrustManager) trustManager;
		assertThat(x509TrustManager.getAcceptedIssuers()).isNotEmpty();
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free