TableSaver { protected TableSaveStrategy createSaveStrategy() { if (deleteTableData) { return new SaveViaDeleteThenInsert(connector, tableName); } if (!mergeByPk && mergeByColumns == null) { return new SaveViaInsert(connector, tableName); } String[] keyColumns = mergeByPk ? getPkColumns() : mergeByColumns; return deleteUnmatchedRows ? new FullSync(connector, tableName, keyColumns) : new SaveViaUpsert(connector, tableName, keyColumns); } TableSaver(JdbcConnector connector, TableFQName tableName); TableSaver deleteTableData(); TableSaver deleteUnmatchedRows(); TableSaver mergeByPk(); TableSaver mergeByColumns(String... columns); SaveStats save(DataFrame df);  }
@Test public void testCreateSaveStrategy_Default() { TableSaver saver = new TableSaver(mock(DefaultJdbcConnector.class), TableFQName.forName("xt")); assertEquals(SaveViaInsert.class, saver.createSaveStrategy().getClass()); }