|
|
|
@ -51,23 +51,18 @@ public class OAuth2AuthorizationConsentAuthenticationContextTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void withWhenAuthenticationNullThenThrowIllegalArgumentException() { |
|
|
|
public void withWhenAuthenticationNullThenThrowIllegalArgumentException() { |
|
|
|
assertThatThrownBy(() -> OAuth2AuthorizationConsentAuthenticationContext.with(null, this.authorizationConsentBuilder)) |
|
|
|
assertThatThrownBy(() -> OAuth2AuthorizationConsentAuthenticationContext.with(null)) |
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
.hasMessage("authentication cannot be null"); |
|
|
|
.hasMessage("authentication cannot be null"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void withWhenAuthorizationConsentBuilderNullThenThrowIllegalArgumentException() { |
|
|
|
|
|
|
|
assertThatThrownBy(() -> OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication, null)) |
|
|
|
|
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
|
|
|
|
.hasMessage("authorizationConsentBuilder cannot be null"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void setWhenValueNullThenThrowIllegalArgumentException() { |
|
|
|
public void setWhenValueNullThenThrowIllegalArgumentException() { |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.Builder builder = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.Builder builder = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication, this.authorizationConsentBuilder); |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThatThrownBy(() -> builder.authorizationConsent(null)) |
|
|
|
|
|
|
|
.isInstanceOf(IllegalArgumentException.class); |
|
|
|
assertThatThrownBy(() -> builder.registeredClient(null)) |
|
|
|
assertThatThrownBy(() -> builder.registeredClient(null)) |
|
|
|
.isInstanceOf(IllegalArgumentException.class); |
|
|
|
.isInstanceOf(IllegalArgumentException.class); |
|
|
|
assertThatThrownBy(() -> builder.authorization(null)) |
|
|
|
assertThatThrownBy(() -> builder.authorization(null)) |
|
|
|
@ -81,7 +76,12 @@ public class OAuth2AuthorizationConsentAuthenticationContextTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void buildWhenRequiredValueNullThenThrowIllegalArgumentException() { |
|
|
|
public void buildWhenRequiredValueNullThenThrowIllegalArgumentException() { |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.Builder builder = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.Builder builder = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication, this.authorizationConsentBuilder); |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThatThrownBy(builder::build) |
|
|
|
|
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
|
|
|
|
.hasMessage("authorizationConsentBuilder cannot be null"); |
|
|
|
|
|
|
|
builder.authorizationConsent(this.authorizationConsentBuilder); |
|
|
|
|
|
|
|
|
|
|
|
assertThatThrownBy(builder::build) |
|
|
|
assertThatThrownBy(builder::build) |
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
.isInstanceOf(IllegalArgumentException.class) |
|
|
|
@ -104,7 +104,8 @@ public class OAuth2AuthorizationConsentAuthenticationContextTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void buildWhenAllValuesProvidedThenAllValuesAreSet() { |
|
|
|
public void buildWhenAllValuesProvidedThenAllValuesAreSet() { |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext context = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext context = |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication, this.authorizationConsentBuilder) |
|
|
|
OAuth2AuthorizationConsentAuthenticationContext.with(this.authorizationCodeRequestAuthentication) |
|
|
|
|
|
|
|
.authorizationConsent(this.authorizationConsentBuilder) |
|
|
|
.registeredClient(this.registeredClient) |
|
|
|
.registeredClient(this.registeredClient) |
|
|
|
.authorization(this.authorization) |
|
|
|
.authorization(this.authorization) |
|
|
|
.authorizationRequest(this.authorizationRequest) |
|
|
|
.authorizationRequest(this.authorizationRequest) |
|
|
|
|