@Test
  public void testMoveColumnToAnotherTable() throws Exception {
    DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class);
    String sourceTableName = getFreeTableName();
    String targetTableName = getFreeTableName();
    int testRowAmount = 10;

    createMyTable(sourceTableName, "col1", "col2");
    createMyTable(targetTableName, "col1");

    for (Integer i=0; i < testRowAmount; i++){
      dbAccessor.insertRow(sourceTableName,
        new String[] {"id", "col1", "col2"},
        new String[]{i.toString(), String.format("'source,1,%s'", i), String.format("'source,2,%s'", i)}, false);

      dbAccessor.insertRow(targetTableName,
        new String[] {"id", "col1"},
        new String[]{i.toString(), String.format("'target,1,%s'", i)}, false);
    }

    DBColumnInfo sourceColumn = new DBColumnInfo("col2", String.class, null, null, false);
    DBColumnInfo targetColumn = new DBColumnInfo("col2", String.class, null, null, false);

    dbAccessor.moveColumnToAnotherTable(sourceTableName, sourceColumn, "id",
      targetTableName, targetColumn, "id", "initial");

    Statement statement = dbAccessor.getConnection().createStatement();
    ResultSet resultSet =  statement.executeQuery("SELECT col2 FROM " + targetTableName + " ORDER BY col2");

    assertNotNull(resultSet);

    List<String> response = new LinkedList<>();

    while (resultSet.next()){
      response.add(resultSet.getString(1));
    }

    assertEquals(testRowAmount, response.toArray().length);

    int i = 0;
    for(String row: response){
      assertEquals(String.format("source,2,%s", i), row);
      i++;
    }

   }
Checks to ensure that columns created with a default have the correct
DEFAULT constraint value set in.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java