/** * Checks that the data in the current temporary upload blob * is what I'd expect. * @param expectedSize The expected size of the data in there. */ private void assertDataInTempBlob(int expectedSize) throws Exception { // Look for the temporary upload blob in the backing store. InMemoryBlockBlobStore backingStore = getTestAccount().getMockStorage().getBackingStore(); String tempKey = null; for (String key : backingStore.getKeys()) { if (key.contains(NativeAzureFileSystem.AZURE_TEMP_FOLDER)) { // Assume this is the one we're looking for. tempKey = key; break; } } assertNotNull(tempKey); try (InputStream inStream = new ByteArrayInputStream( backingStore.getContent(tempKey))) { assertDataInStream(inStream, expectedSize); } }