### Question:
ViewModelColumn extends Column { @Override public String getColumnLine() { if (mColumn != null) { final String modelTableName = mColumn.getSqlName(); final String modelColumnName = mColumn.getName(); final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(modelTableName); stringBuilder.append('.'); stringBuilder.append(modelColumnName); final String source = stringBuilder.toString(); return getColumnLine(source); } else if (mCustomSelection != null) { return getColumnLine(mCustomSelection); } final StringBuilder stringBuilder = new StringBuilder(); final String name = getName(); stringBuilder.append(name); return stringBuilder.toString(); } ViewModelColumn(final String viewName, final String name, final Type type, final String stringType);  ViewModelColumn(final String viewName, final String name, final Type type);  ViewModelColumn(final String viewName, final String name, final Column column);  ViewModelColumn(final String viewName, final Column column);  ViewModelColumn(final String viewName, final String name, final String customSelection, final Type type); @Override String getColumnLine();  }### Answer:
@Test public void getColumnLineWithModelColumnAndRename_returnsCorrectly(){ final ModelColumn modelColumn = new ModelColumn("MODEL_NAME", "MODEL_COLUMN_NAME", Column.Type.text); final ViewModelColumn viewModelColumn = new ViewModelColumn("NAME", "VIEW_MODEL_COLUMN", modelColumn); final String viewModelColumnLine = viewModelColumn.getColumnLine(); assertThat(viewModelColumnLine).isEqualTo("MODEL_NAME.MODEL_COLUMN_NAME AS VIEW_MODEL_COLUMN"); }
@Test public void getColumnLineWithModelColumnRenameAndCustomSelection_returnsCorrectly(){ final ViewModelColumn viewModelColumn = new ViewModelColumn("NAME", "VIEW_MODEL_COLUMN", "SELECT * FROM TABLE", Column.Type.blob); final String viewModelColumnLine = viewModelColumn.getColumnLine(); assertThat(viewModelColumnLine).isEqualTo("SELECT * FROM TABLE AS VIEW_MODEL_COLUMN"); }
@Test public void getColumnLineWithNoTable_returnsJustTheColumnName(){ final ViewModelColumn viewModelColumn = new ViewModelColumn("NAME", "COLUMN_NAME", Column.Type.text); final String viewModelColumnLine = viewModelColumn.getColumnLine(); assertThat(viewModelColumnLine).isEqualTo("COLUMN_NAME"); }
@Test public void getColumnLineWithNoTableAndCustomType_returnsJustTheColumnName(){ final ViewModelColumn viewModelColumn = new ViewModelColumn("NAME", "COLUMN_NAME", Column.Type.text, "VARCHAR(256)"); final String viewModelColumnLine = viewModelColumn.getColumnLine(); assertThat(viewModelColumnLine).isEqualTo("COLUMN_NAME"); }
@Test public void getColumnLineWithModelColumn_returnsCorrectly(){ final ModelColumn modelColumn = new ModelColumn("MODEL_NAME", "MODEL_COLUMN_NAME", Column.Type.text); final ViewModelColumn viewModelColumn = new ViewModelColumn("NAME", modelColumn); final String viewModelColumnLine = viewModelColumn.getColumnLine(); assertThat(viewModelColumnLine).isEqualTo("MODEL_NAME.MODEL_COLUMN_NAME AS MODEL_COLUMN_NAME"); }