final TestXmlDataStore fallbackDataStore = new TestXmlDataStore();
// create caching data store without a cache file
final CachingXmlDataStore store1 = CachingXmlDataStore.createCachingXmlDataStore(cache, DATA_URL_OLDER, VERSION_URL_OLDER, CHARSET,
fallbackDataStore);
final UpdatingUserAgentStringParserImpl parser1 = new UpdatingUserAgentStringParserImpl(store1);
parser1.parse("test");
Thread.sleep(1000l);
final String readIn1 = readFile(cache);
assertThat(readIn1.contains(DATA_VERSION_OLDER)).isTrue();
assertThat(readIn1.length() >= 721915).isTrue();
// create caching data store with filled cache and available update
final CachingXmlDataStore store2 = CachingXmlDataStore.createCachingXmlDataStore(cache, DATA_URL_NEWER, VERSION_URL_NEWER, CHARSET,
fallbackDataStore);
final UpdatingUserAgentStringParserImpl parser2 = new UpdatingUserAgentStringParserImpl(store2);
parser2.parse("test");
Thread.sleep(1000l);
final String readIn2 = readFile(cache);
assertThat(readIn2.contains(DATA_VERSION_NEWER)).isTrue();
assertThat(readIn2.length() >= 721915).isTrue();
// create caching data store with filled cache and without an available update
final CachingXmlDataStore store = CachingXmlDataStore.createCachingXmlDataStore(cache, DATA_URL_NEWER, VERSION_URL_NEWER, CHARSET,
fallbackDataStore);
final UpdatingUserAgentStringParserImpl parser = new UpdatingUserAgentStringParserImpl(store);
parser.parse("test");
Thread.sleep(1000l);
final String readIn = readFile(cache);
assertThat(readIn.contains(DATA_VERSION_NEWER)).isTrue();
assertThat(readIn.length() >= 721915).isTrue();