Skip to content

Commit

Permalink
Add in unit test case
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Apr 5, 2023
1 parent 03557ee commit a2309f0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sigstore-java/src/test/java/dev/sigstore/encryption/KeysTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.google.common.io.Resources;
import java.io.IOException;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PublicKey;
Expand Down Expand Up @@ -184,6 +185,18 @@ void parseTufPublicKey_rsa()
}
}

@Test
void parsePublicKeyBad()
throws IOException, InvalidKeySpecException, NoSuchAlgorithmException,
NoSuchProviderException {
try {
byte[] byteArray = "-----BEGIN A-----\nBBBBB-----END A".getBytes(Charset.defaultCharset());
Keys.parsePublicKey(byteArray);
fail();
} catch (RuntimeException e) {
}
}

@Test
void testGetJavaVersion() {
assertEquals(1, Keys.getJavaVersion("1.6.0_23"));
Expand Down

0 comments on commit a2309f0

Please sign in to comment.