1515 */
1616package org .springframework .vault .support ;
1717
18+ import static org .assertj .core .api .Assertions .*;
19+
1820import java .io .IOException ;
1921import java .net .URL ;
2022import java .security .KeyFactory ;
2729import org .junit .jupiter .params .ParameterizedTest ;
2830import org .junit .jupiter .params .provider .ValueSource ;
2931
30- import static org .assertj .core .api .Assertions .*;
31-
3232/**
3333 * Unit tests for {@link CertificateBundle}.
3434 *
@@ -97,6 +97,18 @@ void invalidEcKeySpecShouldThrowException() {
9797 assertThat (bundle .getPrivateKeySpec ()).isNotNull ();
9898 }
9999
100+ @ Test
101+ void shouldReturnPrivateKey () {
102+
103+ String serialNumber = "aserialnumber" ;
104+ String certificate = "certificate" ;
105+ String caCertificate = "caCertificate" ;
106+ String privateKey = "aprivatekey" ;
107+
108+ CertificateBundle bundle = CertificateBundle .of (serialNumber , certificate , caCertificate , privateKey );
109+ assertThat (bundle .getPrivateKey ()).isNotNull ();
110+ }
111+
100112 @ Test
101113 void getAsKeystore () throws Exception {
102114
@@ -115,9 +127,9 @@ void getAsKeystore() throws Exception {
115127 }
116128
117129 @ ParameterizedTest
118- @ ValueSource (strings = { "certificate-response-rsa-pem.json" , "certificate-response-rsa-der.json" ,
130+ @ ValueSource (strings = {"certificate-response-rsa-pem.json" , "certificate-response-rsa-der.json" ,
119131 "certificate-response-rsa-pembundle.json" , "certificate-response-ec-pem.json" ,
120- "certificate-response-ec-der.json" , "certificate-response-ec-pembundle.json" })
132+ "certificate-response-ec-der.json" , "certificate-response-ec-pembundle.json" })
121133 void createKeystore (String path ) {
122134
123135 CertificateBundle bundle = loadCertificateBundle (path );
@@ -132,7 +144,7 @@ void createKeystore(String path) {
132144 }
133145
134146 @ ParameterizedTest
135- @ ValueSource (strings = { "certificate-response-rsa-pem-pkcs8.json" , "certificate-response-ec-pem-pkcs8.json" })
147+ @ ValueSource (strings = {"certificate-response-rsa-pem-pkcs8.json" , "certificate-response-ec-pem-pkcs8.json" })
136148 void shouldCreateKeystore (String path ) {
137149
138150 CertificateBundle bundle = loadCertificateBundle (path );
0 commit comments