@Test
public void insertShouldWork() throws Exception {
/* test case for https://bitbucket.org/sealuzh/tools-changedistiller/issue/1 */
Node outerTryRight = addToRight(JavaEntityType.TRY_STATEMENT, "");
Node innerTryRight = addToNode(outerTryRight,
JavaEntityType.TRY_STATEMENT, "");
createEditScript();
assertThat(fEditScript.size(), is(2));
TreeEditOperation firstOperation = fEditScript.get(0);
assertThat(firstOperation.getOperationType(), is(OperationType.INSERT));
InsertOperation firstInsert = (InsertOperation) firstOperation;
assertThat(firstInsert.getNodeToInsert().getLabel(), is(outerTryRight.getLabel()));
assertThat(firstInsert.getNodeToInsert().getValue(), is(outerTryRight.getValue()));
TreeEditOperation secondOperation = fEditScript.get(1);
assertThat(secondOperation.getOperationType(), is(OperationType.INSERT));
InsertOperation insert = (InsertOperation) secondOperation;
assertThat(insert.getNodeToInsert().getLabel(), is(innerTryRight.getLabel()));
assertThat(insert.getNodeToInsert().getValue(), is(innerTryRight.getValue()));
assertThat(((Node)insert.getNodeToInsert().getParent()).getLabel(), is(innerTryRight.getLabel()));
assertThat(((Node)insert.getNodeToInsert().getParent()).getValue(), is(innerTryRight.getValue()));
}