@@ -107,6 +107,10 @@ private static String getOidcEnv() {
107107 return getenv ("OIDC_ENV" );
108108 }
109109
110+ private static void assumeAzure () {
111+ assumeTrue (getOidcEnv ().equals ("azure" ));
112+ }
113+
110114 @ Nullable
111115 private static String getUserWithDomain (@ Nullable final String user ) {
112116 return user == null ? null : user + "@" + getenv ("OIDC_DOMAIN" );
@@ -368,14 +372,14 @@ private static void performInsert(final MongoClient mongoClient) {
368372
369373 @ Test
370374 public void test5p1AzureSucceedsWithNoUsername () {
371- assumeTrue ( getOidcEnv (). equals ( "azure" ) );
375+ assumeAzure ( );
372376 String oidcUri = getOidcUri ();
373377 MongoClientSettings clientSettings = createSettings (oidcUri , createCallback (), null );
374378 // Create an OIDC configured client with `ENVIRONMENT:azure` and a valid
375379 // `TOKEN_RESOURCE` and no username.
376380 MongoCredential credential = Assertions .assertNotNull (new ConnectionString (oidcUri ).getCredential ());
377381 assertNotNull (credential .getMechanismProperty (TOKEN_RESOURCE_KEY , null ));
378- assertNull (Assertions . assertNotNull ( clientSettings . getCredential ()) .getUserName ());
382+ assertNull (credential .getUserName ());
379383 try (MongoClient mongoClient = createMongoClient (clientSettings )) {
380384 // Perform a `find` operation that succeeds.
381385 performFind (mongoClient );
@@ -384,7 +388,7 @@ public void test5p1AzureSucceedsWithNoUsername() {
384388
385389 @ Test
386390 public void test5p2AzureFailsWithBadUsername () {
387- assumeTrue ( getOidcEnv (). equals ( "azure" ) );
391+ assumeAzure ( );
388392 String oidcUri = getOidcUri ();
389393 ConnectionString cs = new ConnectionString (oidcUri );
390394 MongoCredential oldCredential = Assertions .assertNotNull (cs .getCredential ());
0 commit comments