File file = new File("./target/cachedir");
String[] files = file.list();
assertEquals("we should have a temp file", files.length, 1);
assertTrue("The file name should start with cos" , files[0].startsWith("cos"));
StreamCache cache = cos.getStreamCache();
assertTrue("Should get the FileInputStreamCache", cache instanceof FileInputStreamCache);
String temp = toString((InputStream)cache);
((InputStream)cache).close();
assertEquals("Cached a wrong file", temp, TEST_STRING);
exchange.getUnitOfWork().done(exchange);
try {
cache.reset();
// The stream is closed, so the temp file is gone.
fail("we expect the exception here");
} catch (Exception exception) {
// do nothing
}