@@ -59,6 +59,7 @@ class MsGraphApiAuthenticationTest {
5959 private final static String CLIENT_ID = System .getenv ("TEST_MS_GRAPH_API_CLIENT_ID" );
6060 private final static String CLIENT_SECRET = System .getenv ("TEST_MS_GRAPH_API_CLIENT_SECRET" );
6161 private final static String TENANT = System .getenv ("TEST_MS_GRAPH_API_TENANT" );
62+ private final static String AUTHENTICATION_URL = System .getenv ("TEST_MS_GRAPH_API_AUTHENTICATION_URL" );
6263
6364 private final MsGraphApiAuthentication msGraphApiAuthentication ;
6465
@@ -75,24 +76,24 @@ static void setup() {
7576
7677 @ Test
7778 void shouldObtainValidAccessToken () throws AuthorizationException {
78- AuthenticationResponse response = msGraphApiAuthentication .authenticate (TENANT , CLIENT_ID , CLIENT_SECRET );
79+ AuthenticationResponse response = msGraphApiAuthentication .authenticate (TENANT , AUTHENTICATION_URL , CLIENT_ID , CLIENT_SECRET );
7980 assertThat (response .getAccessToken ()).isNotBlank ();
8081 assertThatCode (() -> JWT .decode (response .getAccessToken ())).doesNotThrowAnyException ();
8182 }
8283
8384 @ Test
8485 void shouldThrowIfInvalidTenant () {
85- assertThatThrownBy (() -> msGraphApiAuthentication .authenticate ("NOT_A_TENANT" , CLIENT_ID , CLIENT_SECRET )).isInstanceOf (AuthorizationException .class );
86+ assertThatThrownBy (() -> msGraphApiAuthentication .authenticate ("NOT_A_TENANT" , AUTHENTICATION_URL , CLIENT_ID , CLIENT_SECRET )).isInstanceOf (AuthorizationException .class );
8687 }
8788
8889 @ Test
8990 void shouldThrowIfInvalidClientId () {
90- assertThatThrownBy (() -> msGraphApiAuthentication .authenticate (TENANT , "NOT_A_CLIENT_ID" , CLIENT_SECRET )).isInstanceOf (AuthorizationException .class );
91+ assertThatThrownBy (() -> msGraphApiAuthentication .authenticate (TENANT , AUTHENTICATION_URL , "NOT_A_CLIENT_ID" , CLIENT_SECRET )).isInstanceOf (AuthorizationException .class );
9192 }
9293
9394 @ Test
9495 void shouldThrowIfInvalidClientSecret () {
95- assertThatThrownBy (() -> msGraphApiAuthentication .authenticate (TENANT , CLIENT_ID , "NOT_A_SECRET" )).isInstanceOf (AuthorizationException .class );
96+ assertThatThrownBy (() -> msGraphApiAuthentication .authenticate (TENANT , AUTHENTICATION_URL , CLIENT_ID , "NOT_A_SECRET" )).isInstanceOf (AuthorizationException .class );
9697 }
9798
9899}
0 commit comments