@Test
public void testMultiAnnotations() throws Exception {
VariantStorageEngine variantStorageEngine = getVariantStorageEngine();
runDefaultETL(smallInputUri, variantStorageEngine, newStudyConfiguration(),
new ObjectMap(VariantStorageEngine.Options.ANNOTATE.key(), false));
variantStorageEngine.getOptions()
.append(VARIANT_ANNOTATOR_CLASSNAME, TestAnnotator.class.getName())
.append(ANNOTATOR, VariantAnnotatorFactory.AnnotationSource.OTHER);
variantStorageEngine.saveAnnotation("v0", new ObjectMap());
variantStorageEngine.annotate(new Query(), new ObjectMap(TestAnnotator.ANNOT_KEY, "v1").append(OVERWRITE_ANNOTATIONS, true));
variantStorageEngine.saveAnnotation("v1", new ObjectMap());
variantStorageEngine.annotate(new Query(), new ObjectMap(TestAnnotator.ANNOT_KEY, "v2").append(OVERWRITE_ANNOTATIONS, true));
variantStorageEngine.saveAnnotation("v2", new ObjectMap());
variantStorageEngine.annotate(new Query(VariantQueryParam.REGION.key(), "1"), new ObjectMap(TestAnnotator.ANNOT_KEY, "v3").append(OVERWRITE_ANNOTATIONS, true));
assertEquals(0, variantStorageEngine.getAnnotation("v0", null, null).getResult().size());
checkAnnotationSnapshot(variantStorageEngine, "v1", "v1");
checkAnnotationSnapshot(variantStorageEngine, "v2", "v2");
checkAnnotationSnapshot(variantStorageEngine, VariantAnnotationManager.CURRENT, VariantAnnotationManager.CURRENT, "v3", new Query(VariantQueryParam.REGION.key(), "1"));
checkAnnotationSnapshot(variantStorageEngine, VariantAnnotationManager.CURRENT, "v2", "v2", new Query(VariantQueryParam.REGION.key(), "2"));
variantStorageEngine.deleteAnnotation("v1", new ObjectMap());
testQueries(variantStorageEngine);
}