feature-improve-tests: VariantAnnotationCalculatorTest.testExonAnnotation fixed
@@ -35,6 +35,7 @@ import org.opencb.biodata.models.variant.avro.SequenceOntologyTerm;
import org.opencb.biodata.models.variant.avro.VariantAnnotation;
import org.opencb.cellbase.core.config.CellBaseConfiguration;
import org.opencb.cellbase.core.variant.annotation.VariantAnnotationCalculator;
+import org.opencb.cellbase.lib.GenericMongoDBAdaptorTest;
import org.opencb.cellbase.lib.impl.MongoDBAdaptorFactory;
import org.opencb.commons.datastore.core.QueryOptions;
import org.opencb.commons.datastore.core.QueryResult;
@@ -43,6 +44,7 @@ import java.io.*;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.file.Files;
+import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
@@ -53,26 +55,28 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-public class VariantAnnotationCalculatorTest {
+public class VariantAnnotationCalculatorTest extends GenericMongoDBAdaptorTest {
ObjectMapper jsonObjectMapper;
VariantAnnotationCalculator variantAnnotationCalculator;
+ public VariantAnnotationCalculatorTest() throws IOException {
+ }
+
@Before
- public void setUp() {
+ public void setUp() throws Exception {
jsonObjectMapper = new ObjectMapper();
jsonObjectMapper.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true);
jsonObjectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- CellBaseConfiguration cellBaseConfiguration = new CellBaseConfiguration();
- try {
- cellBaseConfiguration = CellBaseConfiguration
- .load(CellBaseConfiguration.class.getClassLoader().getResourceAsStream("configuration.json"));
- } catch (IOException e) {
- e.printStackTrace();
- }
- MongoDBAdaptorFactory dbAdaptorFactory = new MongoDBAdaptorFactory(cellBaseConfiguration);
- variantAnnotationCalculator = new VariantAnnotationCalculator("hsapiens", "GRCh37", dbAdaptorFactory);
+ clearDB(GRCH37_DBNAME);
+ Path path = Paths.get(getClass()
+ .getResource("/variant-annotation/gene.test.json.gz").toURI());
+ loadRunner.load(path, "gene");
+
+ variantAnnotationCalculator = new VariantAnnotationCalculator("hsapiens", "GRCh37",
+ dbAdaptorFactory);
+
}
@Test
