Skip to content

Commit

Permalink
improve OSHDBDriverH2 Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joker234 committed Nov 4, 2022
1 parent da54031 commit 392493d
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package org.heigit.ohsome.oshdb.helpers.db;

import static org.heigit.ohsome.oshdb.OSHDBBoundingBox.bboxWgs84Coordinates;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Properties;
import org.heigit.ohsome.oshdb.api.db.OSHDBDatabase;
import org.heigit.ohsome.oshdb.api.db.OSHDBJdbc;
import org.heigit.ohsome.oshdb.util.tagtranslator.TagTranslator;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

Expand All @@ -17,6 +21,15 @@ public OSHDBDriverH2Test() {
props.setProperty("test-file", "test-data");
}

@SuppressWarnings("ConstantConditions")
private static int testGetters(OSHDBConnection oshdb) {
assertTrue(oshdb.getProps() instanceof Properties);
assertTrue(oshdb.getOSHDB() instanceof OSHDBDatabase);
assertTrue(oshdb.getKeytables() instanceof OSHDBJdbc);
assertTrue(oshdb.getTagTranslator() instanceof TagTranslator);
return 0;
}

@Test
@DisplayName("OSHDBConnection getSnapshotView")
void getSnapshotView() throws Exception {
Expand Down Expand Up @@ -50,12 +63,6 @@ void getContributionView() throws Exception {
@Test
@DisplayName("OSHDBConnection Getter")
void getter() throws Exception {
OSHDBDriver.connect(props, oshdb -> {
assertNotNull(oshdb.getProps());
assertNotNull(oshdb.getOSHDB());
assertNotNull(oshdb.getKeytables());
assertNotNull(oshdb.getTagTranslator());
return 0;
});
OSHDBDriver.connect(props, OSHDBDriverH2Test::testGetters);
}
}

0 comments on commit 392493d

Please sign in to comment.