### Question:
ResourceManager implements Closeable { String getIngestionResource(ResourceType resourceType) throws IngestionServiceException, IngestionClientException { if (!ingestionResources.containsKey(resourceType)) { refreshIngestionResources(); try { ingestionResourcesLock.readLock().lock(); if (!ingestionResources.containsKey(resourceType)) { throw new IngestionServiceException("Unable to get ingestion resources for this type: " + resourceType.getName()); } } finally { ingestionResourcesLock.readLock().unlock(); } } return ingestionResources.get(resourceType).nextValue(); } ResourceManager(Client client, long defaultRefreshTime, long refreshTimeOnFailure);   ResourceManager(Client client); @Override void close();  }### Answer:
@Test void GetIngestionResource_TempStorage_VerifyRoundRubin() throws IngestionServiceException, IngestionClientException { List<String> availableStorages = new ArrayList<>(Arrays.asList(STORAGE_1, STORAGE_2)); String storage = resourceManager.getIngestionResource(ResourceManager.ResourceType.TEMP_STORAGE); int lastIndex = availableStorages.indexOf(storage); for (int i = 0; i < 10; i++) { storage = resourceManager.getIngestionResource(ResourceManager.ResourceType.TEMP_STORAGE); int currIdx = availableStorages.indexOf(storage); assertEquals((lastIndex + 1) % availableStorages.size(), currIdx); lastIndex = currIdx; } }
@Test void GetIngestionResource_AggregationQueue_VerifyRoundRubin() throws IngestionServiceException, IngestionClientException { List<String> availableQueues = new ArrayList<>(Arrays.asList(QUEUE_1, QUEUE_2)); String queue = resourceManager .getIngestionResource(ResourceManager.ResourceType.SECURED_READY_FOR_AGGREGATION_QUEUE); int lastIndex = availableQueues.indexOf(queue); for (int i = 0; i < 10; i++) { queue = resourceManager .getIngestionResource(ResourceManager.ResourceType.SECURED_READY_FOR_AGGREGATION_QUEUE); int currIdx = availableQueues.indexOf(queue); assertEquals((lastIndex + 1) % availableQueues.size(), currIdx); lastIndex = currIdx; } }
@Test void GetIngestionResource_StatusTable_ReturnCorrectTable() throws IngestionServiceException, IngestionClientException { assertEquals( STATUS_TABLE, resourceManager.getIngestionResource(ResourceManager.ResourceType.INGESTIONS_STATUS_TABLE)); }
@Test void GetIngestionResource_FailedIngestionQueue_ReturnCorrectQueue() throws IngestionServiceException, IngestionClientException { assertEquals( FAILED_QUEUE, resourceManager.getIngestionResource(ResourceManager.ResourceType.FAILED_INGESTIONS_QUEUE)); }
@Test void GetIngestionResource_SuccessfulIngestionQueue_ReturnCorrectQueue() throws IngestionServiceException, IngestionClientException { assertEquals( SUCCESS_QUEUE, resourceManager.getIngestionResource(ResourceManager.ResourceType.SUCCESSFUL_INGESTIONS_QUEUE)); }