-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
150 additions
and
562 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package no.maddin.niofs.sftp; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import static org.hamcrest.Matchers.*; | ||
import static org.junit.Assert.assertThat; | ||
|
||
/** | ||
* Tests splitting Path parts. | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class PartsTest { | ||
|
||
private final String input; | ||
private final List<String> result; | ||
|
||
@Parameterized.Parameters(name = "{index}: {0} {1}") | ||
public static List<Object[]> data() { | ||
|
||
return Arrays.asList( | ||
new Object[] {".", Arrays.asList(".")}, | ||
new Object[] {"", Arrays.asList("")}, | ||
new Object[] {"/", Arrays.asList("", "")}, | ||
new Object[] {"./", Arrays.asList(".", "")}, | ||
new Object[] {"/~", Arrays.asList("", "~")}, | ||
new Object[] {"aa", Arrays.asList("aa")}, | ||
new Object[] {"/aa/bb", Arrays.asList("", "aa", "bb")}, | ||
new Object[] {"/aa/../bb", Arrays.asList("", "aa", "..", "bb")}, | ||
new Object[] {"../", Arrays.asList("..", "")} | ||
); | ||
} | ||
|
||
public PartsTest(String input, List<String> result) { | ||
this.input = input; | ||
this.result = result; | ||
} | ||
|
||
@Test | ||
public void splitDot() { | ||
SFTPPath path = new SFTPPath(null, input); | ||
|
||
List<String> parts = path.getParts(); | ||
|
||
assertThat(parts, is(equalTo(this.result))); | ||
// assertThat(parts, hasSize(1)); | ||
// assertThat(parts, hasItem(equalTo("."))); | ||
} | ||
|
||
|
||
} |
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
Oops, something went wrong.