File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import com.intellij.openapi.util.SystemInfo
77import com.intellij.openapi.util.io.NioFiles
88import com.intellij.testFramework.ApplicationExtension
99import org.assertj.core.api.Assertions.assertThat
10+ import org.assertj.core.api.Assertions.assertThatThrownBy
1011import org.junit.jupiter.api.BeforeEach
1112import org.junit.jupiter.api.Test
1213import org.junit.jupiter.api.condition.DisabledOnOs
@@ -714,4 +715,31 @@ class DiskCacheTest {
714715 .usingRecursiveComparison()
715716 .isEqualTo(sut.loadAccessToken(key2))
716717 }
718+
719+ @Test
720+ fun `loadClientRegistration returns null when file not found during registration` () {
721+ val key = DeviceAuthorizationClientRegistrationCacheKey (
722+ startUrl = ssoUrl,
723+ scopes = scopes,
724+ region = ssoRegion
725+ )
726+
727+ assertThat(sut.loadClientRegistration(key, SsoAccessTokenProvider .SourceOfLoadRegistration .REGISTER_CLIENT .toString())).isNull()
728+ }
729+
730+ @Test
731+ fun `loadClientRegistration throws exception when file not found during refresh` () {
732+ val key = DeviceAuthorizationClientRegistrationCacheKey (
733+ startUrl = ssoUrl,
734+ scopes = scopes,
735+ region = ssoRegion
736+ )
737+
738+ assertThatThrownBy {
739+ sut.loadClientRegistration(
740+ key,
741+ SsoAccessTokenProvider .SourceOfLoadRegistration .REFRESH_TOKEN .toString()
742+ )
743+ }.isInstanceOf(ClientRegistrationNotFoundException ::class .java)
744+ }
717745}
You can’t perform that action at this time.
0 commit comments