### Question:
ViewModel extends Model { @Override public String getCreate(final Context context) { final String name = getName(context); final List<Column> columns = getColumns(context); final String createColumns = createColumns(columns); final String selection = getSelection(context); final String create = String.format(CREATE, name, createColumns, selection); return create; }  @Override String getCreate(final Context context); @Override String getDrop(final Context context); @Override int getVersion(final Context context); static String createColumns(final List<Column> columns);  }### Answer:
@Test public void getCreateWithOneViewModelColumn_returnsCorrectCreateAndDrop(){ final MockViewModel mockViewModel = new MockViewModel("VIEW_MODEL", new Path("PATH1", "PATH2")); mockViewModel.setViewModelColums(new ViewModelColumn("VIEW_MODEL","VIEW_MODEL_COLUMN", Column.Type.blob)); final String sqlCreateQuery = mockViewModel.getCreate(mContext); assertThat(sqlCreateQuery).isEqualTo("CREATE VIEW IF NOT EXISTS VIEW_MODEL AS SELECT VIEW_MODEL_COLUMN FROM TABLE JOIN MYTABLE;"); }
@Test public void getCreateWithMultipleViewModelColumn_returnsCorrectCreateAndDrop(){ final MockViewModel mockViewModel = new MockViewModel("VIEW_MODEL", new Path("PATH1", "PATH2")); final ViewModelColumn viewModelColumn = new ViewModelColumn("VIEW_MODEL", "VIEW_MODEL_COLUMN", Column.Type.blob); final ViewModelColumn viewModelColumn1 = new ViewModelColumn("VIEW_MODEL1", "VIEW_MODEL_COLUMN1", Column.Type.real); mockViewModel.setViewModelColums(viewModelColumn, viewModelColumn1); final String sqlCreateQuery = mockViewModel.getCreate(mContext); assertThat(sqlCreateQuery).isEqualTo("CREATE VIEW IF NOT EXISTS VIEW_MODEL AS SELECT VIEW_MODEL_COLUMN, VIEW_MODEL_COLUMN1 FROM TABLE JOIN MYTABLE;"); }
@Test public void getCreateWithNoViewModelColumn_returnsSelectStar(){ final MockViewModel mockViewModel = new MockViewModel("VIEW_MODEL", new Path("PATH1", "PATH2")); final String sqlCreateQuery = mockViewModel.getCreate(mContext); assertThat(sqlCreateQuery).isEqualTo("CREATE VIEW IF NOT EXISTS VIEW_MODEL AS SELECT * FROM TABLE JOIN MYTABLE;"); }