Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
add test cases for #148
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindveg committed Mar 26, 2017
1 parent 7cca19a commit 69591c9
Showing 1 changed file with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,40 @@ public void setUp() throws Exception {
@Test
public void testDocumentsPathCanContainDots() {
final String expected = "Z:\\Users\\S.omeUser\\Documents\\";
final Optional<String> matchForPath = windowsService.getMatchForPath(expected);

assertTrue("Path matches.", matchForPath.isPresent());

final String actual = matchForPath.get();
assertEquals("Path match is equal to inserted path.", expected, actual);
assertPathMatchForExpected(expected);
}

@Test
public void testGetMatchForPath() {
final String expected = "Z:\\Users\\SomeUser\\Documents\\";
assertPathMatchForExpected(expected);
}

@Test
public void testDocumentsPathCanContainDashes() {
final String expected = "Z:\\Users\\user-name\\Documents\\";
assertPathMatchForExpected(expected);
}

@Test
public void testDocumentsPathCanNestQuiteDeep() {
final String expected = "Z:\\Users\\username\\Documents\\OneDrive\\username\\Documents\\";
assertPathMatchForExpected(expected);
}

@Test
public void testDocumentsPathCanContainNumbers() {
final String expected = "Z:\\Users\\user1\\Documents\\";
assertPathMatchForExpected(expected);
}

@Test
public void testCaseForIssue148() {
final String expected = "C:\\Users\\User\\OneDrive\\User-i5\\Documents";
assertPathMatchForExpected(expected);
}

private void assertPathMatchForExpected(String expected) {
final Optional<String> matchForPath = windowsService.getMatchForPath(expected);

assertTrue("Path matches.", matchForPath.isPresent());
Expand Down

0 comments on commit 69591c9

Please sign in to comment.