class SQLiteUtils {

    @NonNull
    static List<String> createUniqueDefinition(TableInfo tableInfo) {
        ArrayList<String> definitions = new ArrayList<>();
        SparseArray<UniqueGroupInfo> uniqueGroups = tableInfo.getUniqueGroups();
        for (int i = 0; i < uniqueGroups.size(); i++) {
            int key = uniqueGroups.keyAt(i);
            UniqueGroupInfo uniqueGroupInfo = uniqueGroups.get(key);
            if (uniqueGroupInfo.columns.size() > 0) {
                definitions.add(String.format("UNIQUE (%s) ON CONFLICT %s",
                        join(uniqueGroupInfo.columns),
                        uniqueGroupInfo.uniqueConflict.toString()));
            }
        }
        return definitions;
    }

}

class SQLiteUtilsTest  {

    @Test
    public void testCreateUniqueDefinition() throws NoSuchFieldException {

        String expectedSql = "UNIQUE (`dateField`, `doubleField`) ON CONFLICT FAIL, " +
                "UNIQUE (`booleanField`, `intField`) ON CONFLICT ROLLBACK";
        TableInfo testModelTableInfo = ReActiveAndroid.getTableInfo(FullTestModel.class);

        List<String> createUniqueDefinitions = SQLiteUtils.createUniqueDefinition(testModelTableInfo);
        assertEquals(expectedSql, TextUtils.join(", ", createUniqueDefinitions));
    }

}