-
Notifications
You must be signed in to change notification settings - Fork 9
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
2 changed files
with
56 additions
and
4 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
33 changes: 33 additions & 0 deletions
33
dashjoin-core/src/test/java/org/dashjoin/util/HomeTest.java
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,33 @@ | ||
package org.dashjoin.util; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class HomeTest { | ||
|
||
@Test | ||
public void testUrlBranch() { | ||
// with branch | ||
Assertions.assertEquals("https://github.com/dashjoin/dashjoin-demo", | ||
Home.getUrlBranch("https://github.com/dashjoin/dashjoin-demo#5.0").url); | ||
Assertions.assertEquals("5.0", | ||
Home.getUrlBranch("https://github.com/dashjoin/dashjoin-demo#5.0").branch); | ||
|
||
// no branch | ||
Assertions.assertEquals("https://github.com/dashjoin/dashjoin-demo", | ||
Home.getUrlBranch("https://github.com/dashjoin/dashjoin-demo").url); | ||
Assertions.assertNull(Home.getUrlBranch("https://github.com/dashjoin/dashjoin-demo").branch); | ||
|
||
// empty string | ||
Assertions.assertEquals("", Home.getUrlBranch("").url); | ||
Assertions.assertNull(Home.getUrlBranch("").branch); | ||
|
||
// illegal double ## - ignore and use url 1:1 | ||
Assertions.assertEquals("file:x##f", Home.getUrlBranch("file:x##f").url); | ||
Assertions.assertNull(Home.getUrlBranch("file:x##f").branch); | ||
|
||
// ends with # - ignore | ||
Assertions.assertEquals("x#", Home.getUrlBranch("x#").url); | ||
Assertions.assertNull(Home.getUrlBranch("x#").branch); | ||
} | ||
} |