### Question:
RemoteDataContextWorkaroundService { public Set<RDSConfig> prepareRdsConfigs(Cluster requestedCluster, DatalakeResources datalakeResources) { Set<RDSConfig> rdsConfigsWithoutHive = requestedCluster.getRdsConfigs(); Set<RDSConfig> hiveDbfromSdx = datalakeResources.getRdsConfigs() .stream() .filter(this::isActiveHiveMetastoreDatabase) .collect(toSet()); if (isHivePresentedInSdx(hiveDbfromSdx)) { rdsConfigsWithoutHive = requestedCluster.getRdsConfigs() .stream() .filter(rdsConfig -> !isHiveMetastoreDatabase(rdsConfig)) .collect(toSet()); } rdsConfigsWithoutHive.addAll(hiveDbfromSdx); return rdsConfigsWithoutHive; }  Set<RDSConfig> prepareRdsConfigs(Cluster requestedCluster, DatalakeResources datalakeResources); FileSystem prepareFilesytem(Cluster requestedCluster, DatalakeResources datalakeResources);  }### Answer:
@Test public void testRdsConfigsWhenHivePresentedShouldReturnWithHiveConfigs() { Set<RDSConfig> rdsConfigs = underTest .prepareRdsConfigs( mockRequestedCluster(mockRds(HIVE), mockRds(RANGER)), mockDatalakeResources(mockRds(HIVE, true))); Assert.assertEquals(2, rdsConfigs.size()); Assert.assertTrue(get(rdsConfigs, HIVE).getStatus().equals(ResourceStatus.DEFAULT)); }
@Test public void testRdsConfigsWhenHiveNotPresentedShouldReturnWithHiveConfigs() { Set<RDSConfig> rdsConfigs = underTest .prepareRdsConfigs( mockRequestedCluster(mockRds(RANGER)), mockDatalakeResources(mockRds(HIVE, true))); Assert.assertEquals(2, rdsConfigs.size()); Assert.assertTrue(get(rdsConfigs, HIVE).getStatus().equals(ResourceStatus.DEFAULT)); }
@Test public void testRdsConfigsWhenHiveNotInDatalakeShouldReturnWithDistroXHiveConfigs() { Set<RDSConfig> rdsConfigs = underTest .prepareRdsConfigs( mockRequestedCluster(mockRds(RANGER), mockRds(HIVE)), mockDatalakeResources()); Assert.assertEquals(2, rdsConfigs.size()); Assert.assertTrue(get(rdsConfigs, HIVE).getStatus().equals(ResourceStatus.USER_MANAGED)); }