48
48
import java .util .concurrent .TimeUnit ;
49
49
import org .junit .jupiter .api .AfterEach ;
50
50
import org .junit .jupiter .api .BeforeEach ;
51
- import org .junit .jupiter .api .Disabled ;
52
51
import org .junit .jupiter .api .Test ;
53
52
import org .mockito .ArgumentCaptor ;
54
53
import org .mockito .Captor ;
@@ -465,7 +464,6 @@ void testIdentifyConnectionWithInvalidNodeIdQuery() throws SQLException {
465
464
}
466
465
467
466
@ Test
468
- @ Disabled
469
467
void testIdentifyConnectionNullTopology () throws SQLException {
470
468
rdsHostListProvider = Mockito .spy (getRdsHostListProvider (
471
469
mockHostListProviderService ,
@@ -475,8 +473,8 @@ void testIdentifyConnectionNullTopology() throws SQLException {
475
473
476
474
when (mockResultSet .next ()).thenReturn (true );
477
475
when (mockResultSet .getString (eq (1 ))).thenReturn ("instance-1" );
478
- when (rdsHostListProvider .refresh (eq ( mockConnection ))). thenReturn ( null );
479
- when (rdsHostListProvider .forceRefresh (eq ( mockConnection ))). thenReturn ( null );
476
+ doReturn ( null ). when (rdsHostListProvider ) .refresh (mockConnection );
477
+ doReturn ( null ). when (rdsHostListProvider ) .forceRefresh (mockConnection );
480
478
481
479
assertNull (rdsHostListProvider .identifyConnection (mockConnection ));
482
480
}
@@ -495,14 +493,13 @@ void testIdentifyConnectionHostNotInTopology() throws SQLException {
495
493
"jdbc:someprotocol://url" ));
496
494
when (mockResultSet .next ()).thenReturn (true );
497
495
when (mockResultSet .getString (eq (1 ))).thenReturn ("instance-1" );
498
- when (rdsHostListProvider .refresh (eq ( mockConnection ))). thenReturn ( cachedTopology );
499
- when (rdsHostListProvider .forceRefresh (eq ( mockConnection ))). thenReturn ( cachedTopology );
496
+ doReturn ( cachedTopology ). when (rdsHostListProvider ) .refresh (mockConnection );
497
+ doReturn ( cachedTopology ). when (rdsHostListProvider ) .forceRefresh (mockConnection );
500
498
501
499
assertNull (rdsHostListProvider .identifyConnection (mockConnection ));
502
500
}
503
501
504
502
@ Test
505
- @ Disabled
506
503
void testIdentifyConnectionHostInTopology () throws SQLException {
507
504
final HostSpec expectedHost = new HostSpecBuilder (new SimpleHostAvailabilityStrategy ())
508
505
.host ("instance-a-1.xyz.us-east-2.rds.amazonaws.com" )
@@ -517,7 +514,8 @@ void testIdentifyConnectionHostInTopology() throws SQLException {
517
514
"jdbc:someprotocol://url" ));
518
515
when (mockResultSet .next ()).thenReturn (true );
519
516
when (mockResultSet .getString (eq (1 ))).thenReturn ("instance-a-1" );
520
- when (rdsHostListProvider .refresh ()).thenReturn (cachedTopology );
517
+ doReturn (cachedTopology ).when (rdsHostListProvider ).refresh (mockConnection );
518
+ doReturn (cachedTopology ).when (rdsHostListProvider ).forceRefresh (mockConnection );
521
519
522
520
final HostSpec actual = rdsHostListProvider .identifyConnection (mockConnection );
523
521
assertEquals ("instance-a-1.xyz.us-east-2.rds.amazonaws.com" , actual .getHost ());
0 commit comments