Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge branch 'master' into JENKINS-14325
Conflicts: changelog.html
- Loading branch information
Showing
11 changed files
with
193 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package hudson.model; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Collection; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.mockito.Mockito.*; | ||
|
||
/** | ||
* @author: <a hef="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a> | ||
*/ | ||
public class ItemsTest { | ||
|
||
private static ItemGroup root; | ||
private static ItemGroup foo; | ||
private static ItemGroup foo_bar; | ||
|
||
@BeforeClass | ||
public static void itemGroups() { | ||
root = mock(ItemGroup.class); | ||
when(root.getFullName()).thenReturn(""); | ||
|
||
foo = mock(ItemGroup.class); | ||
when(foo.getFullName()).thenReturn("foo"); | ||
|
||
foo_bar = mock(ItemGroup.class); | ||
when(foo_bar.getFullName()).thenReturn("foo/bar"); | ||
|
||
} | ||
|
||
@Test | ||
public void getCanonicalName() { | ||
assertEquals("foo", Items.getCanonicalName(root, "foo")); | ||
assertEquals("foo", Items.getCanonicalName(root, "/foo")); | ||
assertEquals("foo/bar", Items.getCanonicalName(root, "foo/bar")); | ||
assertEquals("foo/bar", Items.getCanonicalName(foo, "bar")); | ||
assertEquals("bar", Items.getCanonicalName(foo, "/bar")); | ||
assertEquals("bar", Items.getCanonicalName(foo, "../bar")); | ||
assertEquals("foo/bar", Items.getCanonicalName(foo, "./bar")); | ||
assertEquals("foo/bar/baz/qux", Items.getCanonicalName(foo_bar, "baz/qux")); | ||
assertEquals("foo/baz/qux", Items.getCanonicalName(foo_bar, "../baz/qux")); | ||
} | ||
|
||
@Test | ||
public void computeRelativeNamesAfterRenaming() { | ||
assertEquals("meu,bu,zo", Items.computeRelativeNamesAfterRenaming("ga", "meu", "ga,bu,zo", root )); | ||
assertEquals("ga,bu,zo", Items.computeRelativeNamesAfterRenaming("ga", "meu", "ga,bu,zo", foo_bar )); | ||
assertEquals("meu,bu,zo", Items.computeRelativeNamesAfterRenaming("foo/ga", "foo/meu", "ga,bu,zo", foo )); | ||
|
||
assertEquals("/meu,/bu,/zo", Items.computeRelativeNamesAfterRenaming("ga", "meu", "/ga,/bu,/zo", root )); | ||
assertEquals("/meu,/bu,/zo", Items.computeRelativeNamesAfterRenaming("ga", "meu", "/ga,/bu,/zo", foo_bar )); | ||
|
||
assertEquals("../meu,../bu,../zo", Items.computeRelativeNamesAfterRenaming("ga", "meu", "../ga,../bu,../zo", foo )); | ||
assertEquals("../qux/ga,bu,zo", Items.computeRelativeNamesAfterRenaming("foo/baz", "foo/qux", "../baz/ga,bu,zo", foo_bar )); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters