diff --git a/java-security-test/src/test/java/com/sap/cloud/security/test/JwtGeneratorTest.java b/java-security-test/src/test/java/com/sap/cloud/security/test/JwtGeneratorTest.java index ccd16d5ec8..9d0c4fb49b 100644 --- a/java-security-test/src/test/java/com/sap/cloud/security/test/JwtGeneratorTest.java +++ b/java-security-test/src/test/java/com/sap/cloud/security/test/JwtGeneratorTest.java @@ -15,13 +15,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import org.mockito.Mockito; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SignatureException; @@ -49,11 +44,6 @@ public class JwtGeneratorTest { private static RSAKeys keys; private JwtGenerator cut; - private static final Path RESOURCES_PATH = Paths.get(JwtGeneratorTest.class.getResource("/").getPath()); - - @TempDir - public static File temporaryFolder; - @BeforeAll public static void setUpClass() throws Exception { keys = RSAKeys.fromKeyFiles("/publicKey.txt", "/privateKey.txt"); @@ -291,11 +281,8 @@ public void withClaimValue_asJsonObjectContainingList() { } @Test - public void loadClaimsFromFile_doesNotContainValidJson_throwsException() throws IOException { - File emptyFile = File.createTempFile("empty", null, temporaryFolder); - String temporaryFolderName = emptyFile.getParentFile().getName(); - String resourcePath = "/" + temporaryFolderName + "/empty"; - + public void loadClaimsFromFile_doesNotContainValidJson_throwsException() { + String resourcePath = "/emptyFile.json"; assertThatThrownBy(() -> cut.withClaimsFromFile(resourcePath).createToken()) .isInstanceOf(JsonParsingException.class); } diff --git a/java-security-test/src/test/resources/emptyFile.json b/java-security-test/src/test/resources/emptyFile.json new file mode 100644 index 0000000000..e69de29bb2