### Question:
TeamSystemWebAccessBrowser extends TeamFoundationServerRepositoryBrowser { public URL getDiffLink(final ChangeSet.Item item) throws IOException { if (item.getEditType() != EditType.EDIT) { return null; } return createChangeSetItemLink(item, "compare"); } @DataBoundConstructor  TeamSystemWebAccessBrowser(final String urlExample); String getUrl(); @Override URL getChangeSetLink(final ChangeSet changeSet); URL getFileLink(final ChangeSet.Item item); URL getDiffLink(final ChangeSet.Item item);  }### Answer:
@Test public void assertDiffLinkUsesScmConfiguration() throws Exception { AbstractBuild build = mock(AbstractBuild.class); AbstractProject<?,?> project = mock(AbstractProject.class); when(build.getProject()).thenReturn(project); final TeamFoundationServerScm testScm = createTestScm(null); when(project.getScm()).thenReturn(testScm); ChangeSet changeset = new ChangeSet("62643", null, "user", "comment"); new ChangeLogSet(build, new ChangeSet[]{ changeset}); ChangeSet.Item item = new Item("$/project/folder/folder/branch/some/path/to/some/file.txt", "action"); changeset.add(item); TeamSystemWebAccessBrowser browser = new TeamSystemWebAccessBrowser(""); URL actual = browser.getDiffLink(item); assertEquals("The diff link was incorrect", "http: }
@Test public void assertDiffLink() throws Exception { TeamSystemWebAccessBrowser browser = new TeamSystemWebAccessBrowser("http: ChangeSet changeSet = new ChangeSet("99", null, "user", "comment"); ChangeSet.Item item = new ChangeSet.Item("$/Project/Folder/file.cs", "edit"); changeSet.add(item); URL actual = browser.getDiffLink(item); assertEquals("The diff link was incorrect", "http: }
@Test public void assertDiffLinkWithRealisticServerUrl() throws Exception { TeamSystemWebAccessBrowser browser = new TeamSystemWebAccessBrowser("http: ChangeSet changeSet = new ChangeSet("99", null, "user", "comment"); ChangeSet.Item item = new ChangeSet.Item("$/Project/Folder/file.cs", "edit"); changeSet.add(item); URL actual = browser.getDiffLink(item); assertEquals("The diff link was incorrect", "http: }
@Test public void assertNullDiffLinkForAddedFile() throws Exception { TeamSystemWebAccessBrowser browser = new TeamSystemWebAccessBrowser("http: ChangeSet changeSet = new ChangeSet("99", null, "user", "comment"); ChangeSet.Item item = new ChangeSet.Item("$/Project/Folder/file.cs", "add"); changeSet.add(item); assertNull("The diff link should be null for new files", browser.getDiffLink(item)); }