@Test
public void testLoadTargetResults() throws Exception {

	Map<String, Object> map = new HashMap<String, Object>();
	map.put("platform", "WINDOWS");
	map.put("browserName", "firefox");
	map.put("version", "38");
	final PtlCapabilities capabilities = new PtlCapabilities(map);
	final PersistMetadata metadata = new PersistMetadata("testId", "testClass", "testMethod", "scId", capabilities);
	List<TargetResult> jsonValue = JSONUtils.readValue(
			getClass().getResourceAsStream("FilePersister_TargetResults.json"),
			new TypeReference<List<TargetResult>>() {
			});
	List<TargetResult> expected = new ArrayList<TargetResult>(Lists.transform(jsonValue,
			new Function<TargetResult, TargetResult>() {
				@Override
				public TargetResult apply(TargetResult r) {
					// MetadataはTargetResultとScreenshotImageで異なることに注意
					// JSONから読み込んだTargetResultはScreenshotImageが設定されていないので自分で設定する
					return new TargetResult(r.getResult(), r.getTarget(), r.getExcludes(), r.isMoveTarget(), r
							.getHiddenElementSelectors(), new PersistedScreenshotImage(persister,
							new PersistMetadata("testId", "testClass", "testMethod", "scId", new IndexDomSelector(
									SelectorType.TAG_NAME, "body", 0), null, capabilities)), r.getOptions());
				}
			}));
	File file = new File(BASE_DIRECTORY + "/testId/testClass/testMethod_scId_WINDOWS_firefox_38.json");
	file.getParentFile().mkdirs();
	JSONUtils.writeValue(file, expected);
	List<TargetResult> results = persister.loadTargetResults(metadata);
	assertThat(results, is(expected));
}