comparison test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 423:9c9c442b5f2e

Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 23 Mar 2012 22:51:18 +0100
parents 528b6780a8bd
children 6437d261048a
comparison
equal deleted inserted replaced
422:5d1cc7366d04 423:9c9c442b5f2e
1 /* 1 /*
2 * Copyright (c) 2011 TMate Software Ltd 2 * Copyright (c) 2011-2012 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
23 23
24 import org.junit.Assert; 24 import org.junit.Assert;
25 import org.junit.Ignore; 25 import org.junit.Ignore;
26 import org.junit.Test; 26 import org.junit.Test;
27 import org.tmatesoft.hg.core.HgCatCommand; 27 import org.tmatesoft.hg.core.HgCatCommand;
28 import org.tmatesoft.hg.core.HgException;
29 import org.tmatesoft.hg.core.Nodeid; 28 import org.tmatesoft.hg.core.Nodeid;
30 import org.tmatesoft.hg.internal.ArrayHelper; 29 import org.tmatesoft.hg.internal.ArrayHelper;
31 import org.tmatesoft.hg.repo.HgChangelog; 30 import org.tmatesoft.hg.repo.HgChangelog;
32 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 31 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
33 import org.tmatesoft.hg.repo.HgDataFile; 32 import org.tmatesoft.hg.repo.HgDataFile;
233 final HgDataFile fileNode = repository.getFileNode("file1"); 232 final HgDataFile fileNode = repository.getFileNode("file1");
234 fileNode.walk(0, TIP, new HgDataFile.RevisionInspector() { 233 fileNode.walk(0, TIP, new HgDataFile.RevisionInspector() {
235 int i = 0; 234 int i = 0;
236 235
237 public void next(int localRevision, Nodeid revision, int linkedRevision) { 236 public void next(int localRevision, Nodeid revision, int linkedRevision) {
238 try { 237 Assert.assertEquals(i++, localRevision);
239 Assert.assertEquals(i++, localRevision); 238 Assert.assertEquals(fileNode.getChangesetRevisionIndex(localRevision), linkedRevision);
240 Assert.assertEquals(fileNode.getChangesetRevisionIndex(localRevision), linkedRevision); 239 Assert.assertEquals(fileNode.getRevision(localRevision), revision);
241 Assert.assertEquals(fileNode.getRevision(localRevision), revision);
242 } catch (HgException ex) {
243 Assert.fail(ex.toString());
244 }
245 } 240 }
246 }); 241 });
247 fileNode.walk(0, TIP, new HgDataFile.ParentInspector() { 242 fileNode.walk(0, TIP, new HgDataFile.ParentInspector() {
248 int i = 0; 243 int i = 0;
249 Nodeid[] all = new Nodeid[fileNode.getRevisionCount()]; 244 Nodeid[] all = new Nodeid[fileNode.getRevisionCount()];