Skip to content

Commit 5ecca4b

Browse files
Merge pull request #35986 from izeye
* gh-35986: Remove redundant Files.delete() calls in tests Closes gh-35986
2 parents 7b0aa7d + 4a2c9d9 commit 5ecca4b

File tree

2 files changed

+0
-9
lines changed

2 files changed

+0
-9
lines changed

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/KeyStoreFactoryTests.java

-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package org.springframework.boot.buildpack.platform.docker.ssl;
1818

1919
import java.io.IOException;
20-
import java.nio.file.Files;
2120
import java.nio.file.Path;
2221
import java.security.KeyStore;
2322
import java.security.KeyStoreException;
@@ -60,7 +59,6 @@ void createKeyStoreWithCertChain()
6059
assertThat(keyStore.containsAlias("test-alias-1")).isTrue();
6160
assertThat(keyStore.getCertificate("test-alias-1")).isNotNull();
6261
assertThat(keyStore.getKey("test-alias-1", new char[] {})).isNull();
63-
Files.delete(certPath);
6462
}
6563

6664
@Test
@@ -72,8 +70,6 @@ void createKeyStoreWithCertChainAndRsaPrivateKey()
7270
assertThat(keyStore.containsAlias("test-alias")).isTrue();
7371
assertThat(keyStore.getCertificate("test-alias")).isNotNull();
7472
assertThat(keyStore.getKey("test-alias", new char[] {})).isNotNull();
75-
Files.delete(certPath);
76-
Files.delete(keyPath);
7773
}
7874

7975
}

spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParserTests.java

-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.io.IOException;
2020
import java.net.URI;
2121
import java.net.URISyntaxException;
22-
import java.nio.file.Files;
2322
import java.nio.file.Path;
2423
import java.nio.file.Paths;
2524
import java.security.PrivateKey;
@@ -63,7 +62,6 @@ void parsePkcs8RsaKeyFile() throws IOException {
6362
PrivateKey privateKey = PrivateKeyParser.parse(path);
6463
assertThat(privateKey).isNotNull();
6564
assertThat(privateKey.getFormat()).isEqualTo("PKCS#8");
66-
Files.delete(path);
6765
}
6866

6967
@ParameterizedTest
@@ -93,7 +91,6 @@ void parsePkcs1RsaKeyFile() throws IOException {
9391
assertThat(privateKey).isNotNull();
9492
// keys in PKCS#1 format are converted to PKCS#8 for parsing
9593
assertThat(privateKey.getFormat()).isEqualTo("PKCS#8");
96-
Files.delete(path);
9794
}
9895

9996
@Test
@@ -103,15 +100,13 @@ void parsePkcs1EcKeyFile() throws IOException {
103100
assertThat(privateKey).isNotNull();
104101
// keys in PKCS#1 format are converted to PKCS#8 for parsing
105102
assertThat(privateKey.getFormat()).isEqualTo("PKCS#8");
106-
Files.delete(path);
107103
}
108104

109105
@Test
110106
void parseWithNonKeyFileWillThrowException() throws IOException {
111107
Path path = this.fileWriter.writeFile("text.pem", "plain text");
112108
assertThatIllegalStateException().isThrownBy(() -> PrivateKeyParser.parse(path))
113109
.withMessageContaining(path.toString());
114-
Files.delete(path);
115110
}
116111

117112
@Test

0 commit comments

Comments
 (0)