1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-20 11:22:05 +01:00

Add sessionKey fromString test

This commit is contained in:
Paul Schaub 2022-01-09 01:25:18 +01:00
parent 1b1a13e7d0
commit 824b8de404

View file

@ -6,6 +6,7 @@ package sop.util;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import sop.SessionKey;
@ -45,4 +46,16 @@ public class SessionKeyTest {
assertNotEquals(s1, null);
assertNotEquals(s1, "FCA4BEAF687F48059CACC14FB019125CD57392BAB7037C707835925CBF9F7BCD");
}
@Test
public void fromString_missingAlgorithmIdThrows() {
String missingAlgorithId = "FCA4BEAF687F48059CACC14FB019125CD57392BAB7037C707835925CBF9F7BCD";
assertThrows(IllegalArgumentException.class, () -> SessionKey.fromString(missingAlgorithId));
}
@Test
public void fromString_wrongDivider() {
String semicolonDivider = "9;FCA4BEAF687F48059CACC14FB019125CD57392BAB7037C707835925CBF9F7BCD";
assertThrows(IllegalArgumentException.class, () -> SessionKey.fromString(semicolonDivider));
}
}