@Test
public void testMoveColumnsTo_MoveRight() throws VetoException {

    final Pattern52 pattern1 = boundApplicantPattern("$a");
    final ConditionCol52 column1p1 = ageEqualsCondition();
    final ConditionCol52 column2p1 = nameEqualsCondition();
    modelSynchronizer.appendColumn(pattern1,
                                   column1p1);
    modelSynchronizer.appendColumn(pattern1,
                                   column2p1);
    final Pattern52 pattern2 = boundAddressPattern("$d");
    final ConditionCol52 column1p2 = new ConditionCol52();
    column1p2.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    column1p2.setFactField("state");
    column1p2.setOperator("==");
    column1p2.setHeader("state");
    final ConditionCol52 column2p2 = new ConditionCol52();
    column2p2.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    column2p2.setFactField("country");
    column2p2.setOperator("==");
    column2p2.setHeader("country");
    modelSynchronizer.appendColumn(pattern2,
                                   column1p2);
    modelSynchronizer.appendColumn(pattern2,
                                   column2p2);
    modelSynchronizer.appendRow();
    uiModel.setCellValue(0,
                         3,
                         new BaseGridCellValue<Integer>(45));
    uiModel.setCellValue(0,
                         4,
                         new BaseGridCellValue<String>("Smurf"));
    uiModel.setCellValue(0,
                         5,
                         new BaseGridCellValue<String>("NY"));
    uiModel.setCellValue(0,
                         6,
                         new BaseGridCellValue<String>("America"));
    assertEquals(2,
                 model.getPatterns().size());
    final List<ConditionCol52> conditionColumns1_1p1 = model.getPatterns().get(0).getChildColumns();
    assertEquals(column1p1,
                 conditionColumns1_1p1.get(0));
    assertEquals(column2p1,
                 conditionColumns1_1p1.get(1));
    assertEquals(45,
                 model.getData().get(0).get(3).getNumericValue());
    assertEquals("Smurf",
                 model.getData().get(0).get(4).getStringValue());
    final List<ConditionCol52> conditionColumns1_1p2 = model.getPatterns().get(1).getChildColumns();
    assertEquals(column1p2,
                 conditionColumns1_1p2.get(0));
    assertEquals(column2p2,
                 conditionColumns1_1p2.get(1));
    assertEquals("NY",
                 model.getData().get(0).get(5).getStringValue());
    assertEquals("America",
                 model.getData().get(0).get(6).getStringValue());
    assertEquals(7,
                 uiModel.getColumns().size());
    final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(3);
    final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(4);
    final GridColumn<?> uiModelColumn3_1 = uiModel.getColumns().get(5);
    final GridColumn<?> uiModelColumn4_1 = uiModel.getColumns().get(6);
    assertEquals("$a : Applicant",
                 uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
    assertEquals("$a : Applicant",
                 uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
    assertEquals("$d : Address",
                 uiModelColumn3_1.getHeaderMetaData().get(0).getTitle());
    assertEquals("$d : Address",
                 uiModelColumn4_1.getHeaderMetaData().get(0).getTitle());
    assertTrue(uiModelColumn1_1 instanceof IntegerUiColumn);
    assertTrue(uiModelColumn2_1 instanceof StringUiColumn);
    assertTrue(uiModelColumn3_1 instanceof StringUiColumn);
    assertTrue(uiModelColumn4_1 instanceof StringUiColumn);
    assertEquals(3,
                 uiModelColumn1_1.getIndex());
    assertEquals(4,
                 uiModelColumn2_1.getIndex());
    assertEquals(5,
                 uiModelColumn3_1.getIndex());
    assertEquals(6,
                 uiModelColumn4_1.getIndex());
    assertEquals(45,
                 uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
    assertEquals("Smurf",
                 uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
    assertEquals("NY",
                 uiModel.getRow(0).getCells().get(uiModelColumn3_1.getIndex()).getValue().getValue());
    assertEquals("America",
                 uiModel.getRow(0).getCells().get(uiModelColumn4_1.getIndex()).getValue().getValue());
    // The target column index is the right-most of the target pattern. This
    // index is provided by wires-grid's at runtime when dragging blocked columns.
    uiModel.moveColumnsTo(6,
                          new ArrayList<GridColumn<?>>() {{
                              add(uiModelColumn1_1);
                              add(uiModelColumn2_1);
                          }});
    assertEquals(2,
                 model.getPatterns().size());
    final List<ConditionCol52> conditionColumns1_2p2 = model.getPatterns().get(0).getChildColumns();
    assertEquals(column1p2,
                 conditionColumns1_2p2.get(0));
    assertEquals(column2p2,
                 conditionColumns1_2p2.get(1));
    assertEquals("NY",
                 model.getData().get(0).get(3).getStringValue());
    assertEquals("America",
                 model.getData().get(0).get(4).getStringValue());
    final List<ConditionCol52> conditionColumns1_2p1 = model.getPatterns().get(1).getChildColumns();
    assertEquals(column1p1,
                 conditionColumns1_2p1.get(0));
    assertEquals(column2p1,
                 conditionColumns1_2p1.get(1));
    assertEquals(45,
                 model.getData().get(0).get(5).getNumericValue());
    assertEquals("Smurf",
                 model.getData().get(0).get(6).getStringValue());
    assertEquals(7,
                 uiModel.getColumns().size());
    final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(3);
    final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(4);
    final GridColumn<?> uiModelColumn3_2 = uiModel.getColumns().get(5);
    final GridColumn<?> uiModelColumn4_2 = uiModel.getColumns().get(6);
    assertEquals("$d : Address",
                 uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
    assertEquals("$d : Address",
                 uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
    assertEquals("$a : Applicant",
                 uiModelColumn3_2.getHeaderMetaData().get(0).getTitle());
    assertEquals("$a : Applicant",
                 uiModelColumn4_2.getHeaderMetaData().get(0).getTitle());
    assertTrue(uiModelColumn1_2 instanceof StringUiColumn);
    assertTrue(uiModelColumn2_2 instanceof StringUiColumn);
    assertTrue(uiModelColumn3_2 instanceof IntegerUiColumn);
    assertTrue(uiModelColumn4_2 instanceof StringUiColumn);
    assertEquals(5,
                 uiModelColumn1_2.getIndex());
    assertEquals(6,
                 uiModelColumn2_2.getIndex());
    assertEquals(3,
                 uiModelColumn3_2.getIndex());
    assertEquals(4,
                 uiModelColumn4_2.getIndex());
    assertEquals("NY",
                 uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
    assertEquals("America",
                 uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
    assertEquals(45,
                 uiModel.getRow(0).getCells().get(uiModelColumn3_2.getIndex()).getValue().getValue());
    assertEquals("Smurf",
                 uiModel.getRow(0).getCells().get(uiModelColumn4_2.getIndex()).getValue().getValue());
}