SqlStatementFactory { String createSelectQueryString(String quotedTablePath, EntryColumnData entryColumnData) { return addKeyColumnsToQuery(entryColumnData, new StringBuilder("SELECT * FROM ").append(quotedTablePath)); } SqlStatementFactory(String identifierQuoteString);   }
@Test public void getSelectQueryString() throws Exception { String expectedStatement = String.format("SELECT * FROM %s WHERE %s = ?", QUOTED_TABLE_PATH, quoted(KEY_COLUMN_1_NAME)); String statement = factory.createSelectQueryString(QUOTED_TABLE_PATH, entryColumnData); assertThat(statement).isEqualTo(expectedStatement); }
@Test public void getSelectQueryStringGivenMultipleKeys() throws Exception { keyColumnData.add(new ColumnData(KEY_COLUMN_2_NAME, null, JDBCType.NULL)); String statement = factory.createSelectQueryString(QUOTED_TABLE_PATH, entryColumnData); String expectedStatement = String.format("SELECT * FROM %s WHERE %s = ? AND %s = ?", QUOTED_TABLE_PATH, quoted(KEY_COLUMN_1_NAME), quoted(KEY_COLUMN_2_NAME)); assertThat(statement).isEqualTo(expectedStatement); }