HistoryDialogModel { public List<Revision> getRevisions() { if (myRevisionsCache == null) initRevisionsCache(); return myRevisionsCache; } HistoryDialogModel(IdeaGateway gw, LocalVcs vcs, VirtualFile f); List<Revision> getRevisions(); void selectRevisions(int first, int second); void selectChanges(int first, int second); void showChangesOnly(boolean value); boolean doesShowChangesOnly(); List<Change> getChanges(); void createPatch(String path, boolean isReverse); Reverter createReverter(); boolean isRevertEnabled(); boolean isCreatePatchEnabled(); boolean canPerformCreatePatch();  }
@Test public void testRevisionsList() { List<Revision> rr = m.getRevisions(); assertEquals(3, rr.size()); assertEquals("3", rr.get(0).getCauseChangeName()); assertEquals("2", rr.get(1).getCauseChangeName()); assertEquals("1", rr.get(2).getCauseChangeName()); }
@Test public void testDoesNotRecomputeRevisionsEachTime() { assertEquals(3, m.getRevisions().size()); vcs.changeFileContent("f", null, -1); assertEquals(3, m.getRevisions().size()); }
@Test public void testRegisteringUnsavedDocumentsBeforeBuildingRevisionsList() { gw.addUnsavedDocument("f", "unsaved"); initModelFor("f"); List<Revision> rr = m.getRevisions(); assertEquals(4, rr.size()); assertEquals(c("unsaved"), rr.get(0).getEntry().getContent()); rr = vcs.getRevisionsFor("f"); assertEquals(4, rr.size()); assertEquals(c("unsaved"), rr.get(0).getEntry().getContent()); }