### Question:
RdsLookupService { public Optional<GatekeeperRDSInstance> getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName) { logger.info(dbInstanceIdentifier); Long startTime = System.currentTimeMillis(); List<String> securityGroupIds = sgLookupService.fetchSgsForAccountRegion(environment); AmazonRDSClient amazonRDSClient = awsSessionService.getRDSSession(environment); List<GatekeeperRDSInstance> gatekeeperRDSInstances; if(dbInstanceIdentifier.startsWith("cluster")){ DescribeDBClustersResult result = amazonRDSClient.describeDBClusters( new DescribeDBClustersRequest().withDBClusterIdentifier(instanceName)); gatekeeperRDSInstances = loadToGatekeeperRDSInstanceAurora(environment, amazonRDSClient, result.getDBClusters(), securityGroupIds, DatabaseType.AURORA_REGIONAL); }else { DescribeDBInstancesResult result = amazonRDSClient.describeDBInstances(new DescribeDBInstancesRequest().withDBInstanceIdentifier(instanceName)); gatekeeperRDSInstances = loadToGatekeeperRDSInstance(environment, amazonRDSClient, result.getDBInstances(), securityGroupIds); } logger.info("Fetched Instance in " + ((double)(System.currentTimeMillis() - startTime) / 1000) + " Seconds"); Optional<GatekeeperRDSInstance> gatekeeperRDSInstance = Optional.of(gatekeeperRDSInstances.get(0)); return gatekeeperRDSInstance; } @Autowired  RdsLookupService(AwsSessionService awsSessionService,
                            DatabaseConnectionService databaseConnectionService,
                            SGLookupService sgLookupService,
                            GatekeeperProperties gatekeeperProperties); List<GatekeeperRDSInstance> getInstances(AWSEnvironment environment, String lookupType, String searchString); Optional<DBCluster> getPrimaryClusterForGlobalCluster(AWSEnvironment environment, String globalClusterId); Optional<GatekeeperRDSInstance> getOneInstance(AWSEnvironment environment, String dbInstanceIdentifier, String instanceName); Map<RoleType, List<String>> getSchemasForInstance(AWSEnvironment environment, String instanceId, String instanceName); @PreAuthorize("@gatekeeperRoleService.isApprover() || @gatekeeperRoleService.isAuditor()") List<DbUser> getUsersForInstance(AWSEnvironment environment, String instanceId, String instanceName);  }### Answer:
@Test public void rdsTestGetOneInstance(){ Mockito.when(amazonRDSClient.describeDBInstances(Mockito.any())).thenReturn( new DescribeDBInstancesResult().withDBInstances( initializeInstance("instance1", RDS_ENGINE_PG, "gk-A-instance", "db-gk1", STATUS_AVAILABLE, SG_ONE, null))); Optional<GatekeeperRDSInstance> instance = rdsLookupService.getOneInstance(test, "gk-A-instance", "gk-A-instance"); Assert.assertTrue(instance.isPresent()); Assert.assertEquals("TEST", instance.get().getApplication()); Assert.assertEquals("available", instance.get().getStatus()); Assert.assertEquals(new HashSet<>(Arrays.asList("gk_readonly","gk_datafix","gk_dba")), new HashSet<>(instance.get().getAvailableRoles())); }
@Test public void auroraTestGetOneInstance(){ Mockito.when(amazonRDSClient.describeDBClusters(Mockito.any())).thenReturn( new DescribeDBClustersResult().withDBClusters( initializeCluster("dbendpoint1", "gk-A-cluster", "cluster-gk1", STATUS_AVAILABLE, SG_ONE, null, 2, true)) ); Optional<GatekeeperRDSInstance> instance = rdsLookupService.getOneInstance(test, "cluster-gk1", "gk-A-cluster"); Assert.assertTrue(instance.isPresent()); Assert.assertEquals("TEST", instance.get().getApplication()); Assert.assertEquals("available", instance.get().getStatus()); Assert.assertEquals(new HashSet<>(Arrays.asList("gk_readonly","gk_datafix","gk_dba")), new HashSet<>(instance.get().getAvailableRoles())); }