-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6ab26d
commit 6332a9d
Showing
6 changed files
with
108 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ehealthid/src/test/java/com/oviva/ehealthid/auth/AuthExceptionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.oviva.ehealthid.auth; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class AuthExceptionsTest { | ||
|
||
@Test | ||
void invalidParRequestUri() { | ||
var got = AuthExceptions.invalidParRequestUri("https://example.com"); | ||
assertEquals(AuthException.Reason.INVALID_PAR_URI, got.reason()); | ||
} | ||
|
||
@Test | ||
void missingAuthorizationEndpoint() { | ||
var got = AuthExceptions.missingAuthorizationEndpoint("https://example.com"); | ||
assertEquals(AuthException.Reason.MISSING_AUTHORIZATION_ENDPOINT, got.reason()); | ||
} | ||
|
||
@Test | ||
void missingParEndpoint() { | ||
var got = AuthExceptions.missingParEndpoint("https://example.com"); | ||
assertEquals(AuthException.Reason.MISSING_PAR_ENDPOINT, got.reason()); | ||
} | ||
|
||
@Test | ||
void failedParRequest() { | ||
var cause = new IllegalArgumentException(); | ||
var got = AuthExceptions.failedParRequest("https://fedmaster.example.com", cause); | ||
|
||
assertEquals(AuthException.Reason.FAILED_PAR_REQUEST, got.reason()); | ||
assertEquals(cause, got.getCause()); | ||
} | ||
|
||
@Test | ||
void missingOpenIdConfigurationInEntityStatement() { | ||
var got = AuthExceptions.missingOpenIdConfigurationInEntityStatement("https://example.com"); | ||
|
||
assertEquals( | ||
AuthException.Reason.MISSING_OPENID_CONFIGURATION_IN_ENTITY_STATEMENT, got.reason()); | ||
} | ||
|
||
@Test | ||
void badIdTokenSignature() { | ||
var got = AuthExceptions.badIdTokenSignature("https://example.com"); | ||
assertEquals(AuthException.Reason.INVALID_ID_TOKEN, got.reason()); | ||
} | ||
|
||
@Test | ||
void badIdToken() { | ||
var cause = new IllegalArgumentException(); | ||
var got = AuthExceptions.badIdToken("https://example.com", cause); | ||
assertEquals(AuthException.Reason.INVALID_ID_TOKEN, got.reason()); | ||
assertEquals(cause, got.getCause()); | ||
} | ||
} |