1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package org.eclipse.mylyn.github.tests.ui;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import junit.framework.Assert;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.mylyn.github.internal.GitHub;
import org.eclipse.mylyn.github.ui.internal.GitHubRepositoryConnectorUI;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
import org.junit.Before;
import org.junit.Test;
public class GitHubRepositoryConnectorUITest {
private GitHubRepositoryConnectorUI connectorUI;
private TaskRepository repository;
@Before
public void before() {
connectorUI = new GitHubRepositoryConnectorUI();
repository = new TaskRepository(GitHub.CONNECTOR_KIND, GitHub.createGitHubUrl("foo", "bar"));
}
@Test
public void testFindHyperlinksTaskRepositoryStringIntInt() {
IHyperlink[] hyperlinks = connectorUI.findHyperlinks(repository, "one #2 three", -1, 0);
assertNotNull(hyperlinks);
assertEquals(1,hyperlinks.length);
assertEquals(new Region(4,2),hyperlinks[0].getHyperlinkRegion());
hyperlinks = connectorUI.findHyperlinks(repository, "one #2 three", -1, 4);
assertNotNull(hyperlinks);
assertEquals(1,hyperlinks.length);
assertEquals(new Region(8,2),hyperlinks[0].getHyperlinkRegion());
}
}
|