@@ -146,6 +146,13 @@ public void testBothProviderFixedTokenConfigured() throws Exception {
146146 }
147147 }
148148
149+ /**
150+ * Helper method to get the Fixed SAS token value
151+ */
152+ private String getFixedSASToken (AbfsConfiguration config ) throws Exception {
153+ return config .getSASTokenProvider ().getSASToken (this .getAccountName (), this .getFileSystemName (), getMethodName (), "read" );
154+ }
155+
149156 /**
150157 * Tests the implementation sequence if all fixed SAS configs are set.
151158 * The expected sequence is Container Specific Fixed SAS, Account Specific Fixed SAS, Account Agnostic Fixed SAS.
@@ -161,21 +168,18 @@ public void testFixedTokenPreference() throws Exception {
161168 testAbfsConfig .set (containerProperty (FS_AZURE_SAS_FIXED_TOKEN , this .getFileSystemName (), this .getAccountName ()), containerSAS );
162169 testAbfsConfig .set (accountProperty (FS_AZURE_SAS_FIXED_TOKEN , this .getAccountName ()), accountSAS );
163170 testAbfsConfig .set (FS_AZURE_SAS_FIXED_TOKEN , accountSAS );
164- String ContainerSASExpected = testAbfsConfig .getSASTokenProvider ().getSASToken (this .getAccountName (), this .getFileSystemName (), getMethodName (), "read" );
165171
166172 // Assert that Container Specific Fixed SAS is used
167- Assertions .assertThat (ContainerSASExpected ).contains ("sr=c" );
173+ Assertions .assertThat (getFixedSASToken ( testAbfsConfig ) ).contains ("sr=c" );
168174
169175 // Assert that Account Specific Fixed SAS is used if container SAS isn't set
170176 testAbfsConfig .unset (containerProperty (FS_AZURE_SAS_FIXED_TOKEN , this .getFileSystemName (), this .getAccountName ()));
171- String AccountSASExpected = testAbfsConfig .getSASTokenProvider ().getSASToken (this .getAccountName (), this .getFileSystemName (), getMethodName (), "read" );
172- Assertions .assertThat (AccountSASExpected ).contains ("ss=bf" );
177+ Assertions .assertThat (getFixedSASToken (testAbfsConfig )).contains ("ss=bf" );
173178
174179 //Assert that Account-Agnostic fixed SAS is used if no other fixed SAS configs are set.
175180 // The token is the same as the Account Specific Fixed SAS.
176- testAbfsConfig .unset (FS_AZURE_SAS_FIXED_TOKEN );
177- String AccountAgnosticSASExpected = testAbfsConfig .getSASTokenProvider ().getSASToken (this .getAccountName (), this .getFileSystemName (), getMethodName (), "read" );
178- Assertions .assertThat (AccountAgnosticSASExpected ).contains ("ss=bf" );
181+ testAbfsConfig .unset (accountProperty (FS_AZURE_SAS_FIXED_TOKEN , this .getAccountName ()));
182+ Assertions .assertThat (getFixedSASToken (testAbfsConfig )).contains ("ss=bf" );
179183 }
180184
181185 /**
0 commit comments