@Test public void createShouldUseUniquesPrimaryKeyAndColumns(){ final MockAnnotationModel mockAnnotationModel = new MockAnnotationModel(); final String sqlCreateQuery = mockAnnotationModel.getCreate(mContext); assertThat(sqlCreateQuery).isEqualTo("CREATE TABLE IF NOT EXISTS MockAnnotationModel " + "(" + " MODEL_COLUMN_1 TEXT," + " MODEL_COLUMN_2 TEXT," + " MODEL_COLUMN_3 TEXT," + " UNIQUE ( MODEL_COLUMN_2 ) ON CONFLICT REPLACE," + " PRIMARY KEY ( MODEL_COLUMN_3 ) " + ");"); }
@Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final Set<Column> uniqueColumns = getUniqueColumns(context); final Set<Column> primaryKeyColumns = getPrimaryKeyColumns(context); final String createColumns = createColumns(columns, uniqueColumns, primaryKeyColumns); final String create = String.format(CREATE, name, createColumns); return create; }
Model extends Content { @Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final Set<Column> uniqueColumns = getUniqueColumns(context); final Set<Column> primaryKeyColumns = getPrimaryKeyColumns(context); final String createColumns = createColumns(columns, uniqueColumns, primaryKeyColumns); final String create = String.format(CREATE, name, createColumns); return create; } }
Model extends Content { @Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final Set<Column> uniqueColumns = getUniqueColumns(context); final Set<Column> primaryKeyColumns = getPrimaryKeyColumns(context); final String createColumns = createColumns(columns, uniqueColumns, primaryKeyColumns); final String create = String.format(CREATE, name, createColumns); return create; } Model(); }
Model extends Content { @Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final Set<Column> uniqueColumns = getUniqueColumns(context); final Set<Column> primaryKeyColumns = getPrimaryKeyColumns(context); final String createColumns = createColumns(columns, uniqueColumns, primaryKeyColumns); final String create = String.format(CREATE, name, createColumns); return create; } Model(); void initializeAnnotations(); void initializeAnnotations(final Class klass); void initializePathDefinitions(Class<?> declaredClass); void initializeColumnDefinitions(Class<?> declaredClass); @Override String getCreate(final Context context); @Override String getDrop(final Context context); Set<Column> getUniqueColumns(final Context context); @Override int getVersion(final Context context); List<Column> getColumns(Context context); static String createColumns(final List<Column> columns, final Set<Column> uniqueColumns, final Set<Column> primaryKeyColumns); @Override List<Path> getPaths(Context context); Set<Column> getPrimaryKeyColumns(final Context context); }
Model extends Content { @Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final Set<Column> uniqueColumns = getUniqueColumns(context); final Set<Column> primaryKeyColumns = getPrimaryKeyColumns(context); final String createColumns = createColumns(columns, uniqueColumns, primaryKeyColumns); final String create = String.format(CREATE, name, createColumns); return create; } Model(); void initializeAnnotations(); void initializeAnnotations(final Class klass); void initializePathDefinitions(Class<?> declaredClass); void initializeColumnDefinitions(Class<?> declaredClass); @Override String getCreate(final Context context); @Override String getDrop(final Context context); Set<Column> getUniqueColumns(final Context context); @Override int getVersion(final Context context); List<Column> getColumns(Context context); static String createColumns(final List<Column> columns, final Set<Column> uniqueColumns, final Set<Column> primaryKeyColumns); @Override List<Path> getPaths(Context context); Set<Column> getPrimaryKeyColumns(final Context context);  }