LocalTableProvider extends BaseTableProvider { @Override public ReadWriteTable getTable() { Preconditions.checkNotNull(context, String.format("Table %s not initialized", tableId)); Preconditions.checkNotNull(kvStore, "Store not initialized for table " + tableId); @SuppressWarnings("unchecked") ReadWriteTable table = new LocalTable(tableId, kvStore); table.init(this.context); return table; } LocalTableProvider(String tableId); @Override void init(Context context); @Override ReadWriteTable getTable();  }
@Test(expected = NullPointerException.class) public void testInitFail() { TableProvider tableProvider = createTableProvider("t1"); Assert.assertNotNull(tableProvider.getTable()); }