StringDataStore { public String retrieveData(String token) { try { RetrievedContent data = this.s3StorageProvider.getContent(this.hiddenSpaceName, token); return IOUtil.readStringFromStream(data.getContentStream()); } catch (NotFoundException ex) { return null; } catch (Exception ex) { throw new DuraCloudRuntimeException(ex); } } StringDataStore(String hiddenSpaceName, S3StorageProvider s3StorageProvider); String storeData(String cookieData); String retrieveData(String token);  }
@Test public void testRetrieveData() throws Exception { InputStream is = IOUtil.writeStringToStream("test"); expect(retrievedContent.getContentStream()).andReturn(is); expect(storageProvider.getContent(eq(hiddenSpaceName), eq(token))).andReturn(retrievedContent); replayAll(); String data = this.stringDataStore.retrieveData(token); assertEquals("The retrieved data did not equal the expected value", "test", data); }