@Test
@SuppressFBWarnings({"RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE",

  "NP_LOAD_OF_KNOWN_NULL_VALUE", "CLI_CONSTANT_LIST_INDEX"})
// try with resources trips up findbugs sometimes.
@SuppressWarnings("checkstyle:EmptyBlock")
public void testTsdb() throws IOException {
  File testFile = File.createTempFile("test", ".tsdb2");
  long tableId;
  try (TSDBWriter writer = new TSDBWriter(testFile, 4, "test", false)) {
  }
  try (TSDBWriter writer = new TSDBWriter(testFile, 4, "test", false)) {
    tableId = writer.writeTableDef(tableDef);
    final long time = System.currentTimeMillis();
    writer.writeDataRow(tableId, time, 0, 1, 2);
    writer.writeDataRow(tableId, time + 10, 1, 1, 2);
    writer.writeDataRow(tableId, time + 20, 2, 1, 2);
    writer.writeDataRow(tableId, time + 30, 3, 1, 2);
    writer.writeDataRow(tableId, time + 40, 4, 1, 2);
  }
  try (TSDBReader reader = new TSDBReader(testFile, 1024)) {
    Either<TableDef, DataBlock> read;
    while ((read = reader.read()) != null) {
      LOG.debug("TSDB block: {}", read);
    }
  }
  ListMultimap<String, TableDef> allTables = TSDBQuery.getAllTables(testFile);
  Assert.assertEquals(1, allTables.size());
  Assert.assertTrue(allTables.containsKey(tableDef.getName()));
  TimeSeries timeSeries = TSDBQuery.getTimeSeries(testFile, new long[]{tableId}, 0, Long.MAX_VALUE);
  Assert.assertEquals(2L, timeSeries.getValues()[2][0]);
}