Home / Class/ SslBundleKeyTests Class — spring-boot Architecture

SslBundleKeyTests Class — spring-boot Architecture

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

Entity Profile

Source Code

core/spring-boot/src/test/java/org/springframework/boot/ssl/SslBundleKeyTests.java lines 34–75

class SslBundleKeyTests {

	@Test
	void noneHasNoValues() {
		SslBundleKey keyReference = SslBundleKey.NONE;
		assertThat(keyReference.getPassword()).isNull();
		assertThat(keyReference.getAlias()).isNull();
	}

	@Test
	void ofCreatesWithPasswordSslKeyReference() {
		SslBundleKey keyReference = SslBundleKey.of("password");
		assertThat(keyReference.getPassword()).isEqualTo("password");
		assertThat(keyReference.getAlias()).isNull();
	}

	@Test
	void ofCreatesWithPasswordAndAliasSslKeyReference() {
		SslBundleKey keyReference = SslBundleKey.of("password", "alias");
		assertThat(keyReference.getPassword()).isEqualTo("password");
		assertThat(keyReference.getAlias()).isEqualTo("alias");
	}

	@Test
	void getKeyManagerFactoryWhenHasAliasNotInStoreThrowsException() throws Exception {
		KeyStore keyStore = mock(KeyStore.class);
		given(keyStore.containsAlias("alias")).willReturn(false);
		SslBundleKey key = SslBundleKey.of("secret", "alias");
		assertThatIllegalStateException().isThrownBy(() -> key.assertContainsAlias(keyStore))
			.withMessage("Keystore does not contain alias 'alias'");
	}

	@Test
	void getKeyManagerFactoryWhenHasAliasNotDeterminedInStoreThrowsException() throws Exception {
		KeyStore keyStore = mock(KeyStore.class);
		given(keyStore.containsAlias("alias")).willThrow(KeyStoreException.class);
		SslBundleKey key = SslBundleKey.of("secret", "alias");
		assertThatIllegalStateException().isThrownBy(() -> key.assertContainsAlias(keyStore))
			.withMessage("Could not determine if keystore contains alias 'alias'");
	}

}

Analyze Your Own Codebase

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

Try Supermodel Free