Skip to content

Commit

Permalink
fixing JwtGeneratorTest in java-security-test module manually
Browse files Browse the repository at this point in the history
  • Loading branch information
aamotharald committed Nov 26, 2024
1 parent abe4908 commit 2f0fa3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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);
}
Expand Down
Empty file.

0 comments on commit 2f0fa3a

Please sign in to comment.