@Test
public void testUpdateMutation() throws Exception {

  Serializable[] old = new Serializable[4];
  old[0] = 12131L;
  old[1] = "test_user";
  old[2] = 25;
  old[3] = 0;
  Serializable[] current = new Serializable[4];
  current[0] = old[0];
  current[1] = old[1];
  current[2] = 26;
  current[3] = old[3];
  Serializable[] old2 = new Serializable[4];
  old2[0] = 12334L;
  old2[1] = "test_user2";
  old2[2] = 30;
  old2[3] = 1;
  Serializable[] current2 = new Serializable[4];
  current2[0] = old2[0];
  current2[1] = old2[1];
  current2[2] = 31;
  current2[3] = old2[3];
  Map.Entry<Serializable[], Serializable[]> change = new AbstractMap.SimpleEntry<>(old, current);
  Map.Entry<Serializable[], Serializable[]> change2 =
      new AbstractMap.SimpleEntry<>(old2, current2);
  BinlogEvent event =
      new UpdateEvent(
          TABLE_ID, SERVER_ID, TIMESTAMP, BINLOG_FILE_POS, ImmutableList.of(change, change2));
  List<? extends Mutation> mutations = eventMapper.map(event);
  assertEquals(2, mutations.size());
  assertTrue(mutations.get(0) instanceof MysqlUpdateMutation);
  MysqlUpdateMutation mutation = (MysqlUpdateMutation) mutations.get(0);
  validateMetadata(mutation, 0);
  Row oldRow = mutation.getPreviousRow();
  Row newRow = mutation.getRow();
  assertEquals(12131L, oldRow.getColumns().get("id").getValue());
  assertEquals("test_user", oldRow.getColumns().get("name").getValue());
  assertEquals(25, oldRow.getColumns().get("age").getValue());
  assertEquals(0, oldRow.getColumns().get("sex").getValue());
  assertEquals(12131L, newRow.getColumns().get("id").getValue());
  assertEquals("test_user", newRow.getColumns().get("name").getValue());
  assertEquals(26, newRow.getColumns().get("age").getValue());
  assertEquals(0, newRow.getColumns().get("sex").getValue());
  assertTrue(mutations.get(1) instanceof MysqlUpdateMutation);
  mutation = (MysqlUpdateMutation) mutations.get(1);
  validateMetadata(mutation, 1);
  oldRow = mutation.getPreviousRow();
  newRow = mutation.getRow();
  assertEquals(12334L, oldRow.getColumns().get("id").getValue());
  assertEquals("test_user2", oldRow.getColumns().get("name").getValue());
  assertEquals(30, oldRow.getColumns().get("age").getValue());
  assertEquals(1, oldRow.getColumns().get("sex").getValue());
  assertEquals(12334L, newRow.getColumns().get("id").getValue());
  assertEquals("test_user2", newRow.getColumns().get("name").getValue());
  assertEquals(31, newRow.getColumns().get("age").getValue());
  assertEquals(1, newRow.getColumns().get("sex").getValue());
}