### Question:
UpdateVisitor implements ChangeSetVisitor { public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database) throws LiquibaseException { ChangeSet.RunStatus runStatus = this.database.getRunStatus(changeSet); log.debug("Running Changeset:" + changeSet); ChangeSet.ExecType execType = changeSet.execute(databaseChangeLog, this.database); if (!runStatus.equals(ChangeSet.RunStatus.NOT_RAN)) { execType = ChangeSet.ExecType.RERAN; } this.database.markChangeSetExecStatus(changeSet, execType); this.database.commit(); } UpdateVisitor(Database database); Direction getDirection(); void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database);  }### Answer:
@Test public void visit_unrun() throws Exception { Database database = createMock(Database.class); ChangeSet changeSet = createMock(ChangeSet.class); expect(changeSet.execute(new DatabaseChangeLog("test.xml"), database)).andReturn(ChangeSet.ExecType.EXECUTED); expect(database.getRunStatus(changeSet)).andReturn(ChangeSet.RunStatus.NOT_RAN); database.markChangeSetExecStatus(changeSet, ChangeSet.ExecType.EXECUTED); expectLastCall(); database.commit(); expectLastCall(); replay(changeSet); replay(database); UpdateVisitor visitor = new UpdateVisitor(database); visitor.visit(changeSet, new DatabaseChangeLog("test.xml"), database); verify(database); verify(changeSet); }