mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-14 20:42:21 +00:00
[JENKINS-17713] Preparing unit and functional test coverage.
This commit is contained in:
1 parent
93b82be199
commit
a5ac54eac8
2 files changed
+37
-1
No files matched your search
@@ -171,7 +171,24 @@ public class FunctionsTest {
|
||||
String result = Functions.getRelativeLinkTo(i);
|
||||
assertEquals("job/i/", result);
|
||||
}
|
||||
|
||||
|
||||
@Bug(17713)
|
||||
@PrepareForTest({Stapler.class, Jenkins.class})
|
||||
@Test public void getRelativeLinkTo_MavenModules() throws Exception {
|
||||
Jenkins j = createMockJenkins();
|
||||
StaplerRequest req = createMockRequest("/jenkins");
|
||||
mockStatic(Stapler.class);
|
||||
when(Stapler.getCurrentRequest()).thenReturn(req);
|
||||
TopLevelItemAndItemGroup ms = mock(TopLevelItemAndItemGroup.class);
|
||||
when(ms.getShortUrl()).thenReturn("job/ms/");
|
||||
// XXX "." (in second ancestor) is what Stapler currently fails to do. Could edit test to use ".." but set a different request path?
|
||||
createMockAncestors(req, createAncestor(j, "../.."), createAncestor(ms, "."));
|
||||
Item m = mock(Item.class);
|
||||
when(m.getParent()).thenReturn(ms);
|
||||
when(m.getShortUrl()).thenReturn("grp$art/");
|
||||
assertEquals("grp$art/", Functions.getRelativeLinkTo(m));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRelativeDisplayName() {
|
||||
Item i = mock(Item.class);
|
||||
|
||||
Reference in new issue
Block a user