4646import  static  org .assertj .core .api .Assertions .assertThat ;
4747import  static  org .junit .jupiter .api .Assumptions .assumeFalse ;
4848import  static  org .junit .jupiter .api .Assumptions .assumeTrue ;
49+ import  static  org .assertj .core .api .Assertions .assertThat ;
50+ import  static  org .assertj .core .api .Assertions .assertThatExceptionOfType ;
51+ import  static  org .junit .jupiter .api .Assertions .assertArrayEquals ;
52+ import  static  org .junit .jupiter .api .Assertions .assertEquals ;
53+ import  static  org .junit .jupiter .api .Assertions .assertFalse ;
54+ import  static  org .junit .jupiter .api .Assertions .assertInstanceOf ;
55+ import  static  org .junit .jupiter .api .Assertions .assertNotNull ;
56+ import  static  org .junit .jupiter .api .Assertions .assertNotSame ;
57+ import  static  org .junit .jupiter .api .Assertions .assertNotEquals ;
58+ import  static  org .junit .jupiter .api .Assertions .assertNull ;
59+ import  static  org .junit .jupiter .api .Assertions .assertSame ;
60+ import  static  org .junit .jupiter .api .Assertions .assertThrows ;
61+ import  static  org .junit .jupiter .api .Assertions .assertTrue ;
62+ import  static  org .junit .jupiter .api .Assertions .fail ;
63+ import  static  org .junit .jupiter .api .Assumptions .assumeFalse ;
64+ import  static  org .junit .jupiter .api .Assumptions .assumeTrue ;
4965import  static  org .mockito .ArgumentMatchers .any ;
66+ import  static  org .mockito .ArgumentMatchers .nullable ;
67+ import  static  org .mockito .Mockito .any ;
68+ import  static  org .mockito .Mockito .anyBoolean ;
69+ import  static  org .mockito .Mockito .anyInt ;
70+ import  static  org .mockito .Mockito .anyLong ;
71+ import  static  org .mockito .Mockito .anyList ;
5072import  static  org .mockito .Mockito .anyString ;
73+ import  static  org .mockito .Mockito .atMost ;
74+ import  static  org .mockito .Mockito .atLeast ;
75+ import  static  org .mockito .Mockito .atLeastOnce ;
76+ import  static  org .mockito .Mockito .doAnswer ;
77+ import  static  org .mockito .Mockito .doCallRealMethod ;
78+ import  static  org .mockito .Mockito .doNothing ;
5179import  static  org .mockito .Mockito .doReturn ;
5280import  static  org .mockito .Mockito .doThrow ;
5381import  static  org .mockito .Mockito .mock ;
@@ -365,17 +393,17 @@ public void testNameSpaceConfig() throws Exception {
365393    AbfsConfiguration  abfsConfig  = new  AbfsConfiguration (configuration , "bogusAccountName" );
366394
367395    // Test that the namespace value when config is not set 
368-     Assertions . assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
396+     assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
369397        .describedAs ("Namespace enabled should be unknown in case config is not set" )
370398        .isEqualTo (Trilean .UNKNOWN );
371399
372400    // In case no namespace config is present, file system init calls getAcl() to determine account type. 
373-     Assertions . assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
401+     assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
374402        .describedAs ("getIsNamespaceEnabled should return account type based on getAcl() call" )
375403        .isEqualTo (abfs .getAbfsClient ().getIsNamespaceEnabled ());
376404
377405    // In case no namespace config is present, file system init calls getAcl() to determine account type. 
378-     Assertions . assertThat (abfs .getAbfsStore ().getAbfsConfiguration ().getIsNamespaceEnabledAccount ())
406+     assertThat (abfs .getAbfsStore ().getAbfsConfiguration ().getIsNamespaceEnabledAccount ())
379407        .describedAs ("getIsNamespaceEnabled() should return updated account type based on getAcl() call" )
380408        .isNotEqualTo (Trilean .UNKNOWN );
381409
@@ -384,17 +412,17 @@ public void testNameSpaceConfig() throws Exception {
384412    abfsConfig  = new  AbfsConfiguration (configuration , "bogusAccountName" );
385413
386414    // Test that the namespace enabled config is set correctly 
387-     Assertions . assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
415+     assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
388416        .describedAs ("Namespace enabled should be true in case config is set to true" )
389417        .isEqualTo (Trilean .TRUE );
390418
391419    // In case namespace config is present, same value will be return. 
392-     Assertions . assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
420+     assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
393421        .describedAs ("getIsNamespaceEnabled() should return true when config is set to true" )
394422        .isEqualTo (true );
395423
396424    // In case namespace config is present, same value will be return. 
397-     Assertions . assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
425+     assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
398426        .describedAs ("Client's getIsNamespaceEnabled() should return true when config is set to true" )
399427        .isEqualTo (true );
400428
@@ -403,17 +431,17 @@ public void testNameSpaceConfig() throws Exception {
403431    abfsConfig  = new  AbfsConfiguration (configuration , "bogusAccountName" );
404432
405433    // Test that the namespace enabled config is set correctly 
406-     Assertions . assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
434+     assertThat (abfsConfig .getIsNamespaceEnabledAccount ())
407435        .describedAs ("Namespace enabled should be false in case config is set to false" )
408436        .isEqualTo (Trilean .FALSE );
409437
410438    // In case namespace config is present, same value will be return. 
411-     Assertions . assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
439+     assertThat (abfs .getIsNamespaceEnabled (getTestTracingContext (abfs , false )))
412440        .describedAs ("getIsNamespaceEnabled() should return false when config is set to false" )
413441        .isEqualTo (false );
414442
415443    // In case namespace config is present, same value will be return. 
416-     Assertions . assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
444+     assertThat (abfs .getAbfsClient ().getIsNamespaceEnabled ())
417445        .describedAs ("Client's getIsNamespaceEnabled() should return false when config is set to false" )
418446        .isEqualTo (false );
419447  }
@@ -428,15 +456,15 @@ public void testNameSpaceConfig() throws Exception {
428456  @ Test 
429457  public  void  testFsInitShouldSetNamespaceConfig () throws  Exception  {
430458    // Mock the AzureBlobFileSystem and its dependencies 
431-     AzureBlobFileSystem  mockFileSystem  = Mockito . spy ((AzureBlobFileSystem )
459+     AzureBlobFileSystem  mockFileSystem  = spy ((AzureBlobFileSystem )
432460        FileSystem .newInstance (getConfigurationWithoutHnsConfig ()));
433-     AzureBlobFileSystemStore  mockStore  = Mockito . spy (mockFileSystem .getAbfsStore ());
434-     AbfsClient  abfsClient  = Mockito . spy (mockStore .getClient ());
435-     Mockito . doReturn (abfsClient ).when (mockStore ).getClient ();
436-     Mockito . doReturn (abfsClient ).when (mockStore ).getClient (any ());
461+     AzureBlobFileSystemStore  mockStore  = spy (mockFileSystem .getAbfsStore ());
462+     AbfsClient  abfsClient  = spy (mockStore .getClient ());
463+     doReturn (abfsClient ).when (mockStore ).getClient ();
464+     doReturn (abfsClient ).when (mockStore ).getClient (any ());
437465    abfsClient .getIsNamespaceEnabled ();
438466    // Verify that getAclStatus is called once during initialization 
439-     Mockito . verify (abfsClient , times (0 ))
467+     verify (abfsClient , times (0 ))
440468        .getAclStatus (anyString (), any (TracingContext .class ));
441469
442470    mockStore .getAbfsConfiguration ().setIsNamespaceEnabledAccountForTesting (Trilean .UNKNOWN );
@@ -445,19 +473,19 @@ public void testFsInitShouldSetNamespaceConfig() throws Exception {
445473    String  errorMessage  = intercept (InvalidConfigurationValueException .class , () -> {
446474      abfsClient .getIsNamespaceEnabled ();
447475    }).getMessage ();
448-     Assertions . assertThat (errorMessage )
476+     assertThat (errorMessage )
449477        .describedAs ("Client should throw exception when namespace is unknown" )
450478        .contains ("Failed to determine account type" );
451479
452480    // In case of unknown namespace, store's getIsNamespaceEnabled should call getAclStatus 
453481    // to determine the namespace status. 
454482    mockStore .getIsNamespaceEnabled (getTestTracingContext (mockFileSystem , false ));
455-     Mockito . verify (abfsClient , times (1 ))
483+     verify (abfsClient , times (1 ))
456484        .getAclStatus (anyString (), any (TracingContext .class ));
457485
458486    abfsClient .getIsNamespaceEnabled ();
459487    // Verify that client's getNamespaceEnabled will not call getAclStatus again 
460-     Mockito . verify (abfsClient , times (1 ))
488+     verify (abfsClient , times (1 ))
461489        .getAclStatus (anyString (), any (TracingContext .class ));
462490  }
463491
0 commit comments