Skip to content

Commit

Permalink
Do not assert changeset paths are unique
Browse files Browse the repository at this point in the history
Previously, the code asserted that the paths in a changeset were unique.
They may be unique when a single commit is in the changeset.  In those
cases where the changeset includes a merge, the paths are not unique if
both sides of the merge modified a file.  When a file is modified on
both sides of a merge, then the file will be correctly listed on both
sides of the merge.
  • Loading branch information
MarkEWaite committed Dec 5, 2022
1 parent 699eef5 commit 9a4ddc2
Showing 1 changed file with 0 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,26 +126,13 @@ public void testGetNormalizeUrl() {

@Test
public void testGetIndexOfPath() throws Exception {
Set<Integer> foundLocations = new HashSet<>(paths.size());
for (GitChangeSet.Path path : paths) {
int location = browser.getIndexOfPath(path);

// Assert that location is in bounds
assertThat(location, is(lessThan(paths.size())));
assertThat(location, is(greaterThan(-1)));

// Assert that location has not been seen before
assertThat("Location " + location +
" for path " + path.getPath() + " already seen," +
" with useAuthorName: " + useAuthorName +
", implementation " + gitImplementation +
" at sha1:" + ObjectId.toString(sha1),
foundLocations, not(hasItem(location)));
foundLocations.add(location);
}

// Assert that exact number of locations were found
assertThat(foundLocations.size(), is(paths.size()));
}

private URL getURL(GitChangeSet.Path path, boolean isDiffLink) throws MalformedURLException {
Expand Down

0 comments on commit 9a4ddc2

Please sign in to comment.