Created
February 10, 2014 13:19
-
-
Save miguelaferreira/8915777 to your computer and use it in GitHub Desktop.
Test for NfsUtils.url2Mount(String strUrl)
This file contains hidden or 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
public class NfsUtilsTest { | |
@Test(expected = NullPointerException.class) | |
public void testUrl2MountWithExpectedWhenStringIsNull() throws Exception { | |
String urlStr = null; | |
NfsUtils.url2Mount(urlStr); | |
} | |
@Test | |
public void testUrl2MountWhenStringIsEmpty() throws Exception { | |
String urlStr = ""; | |
String expected = "null:"; | |
String actual = NfsUtils.url2Mount(urlStr); | |
assertEquals(expected, actual); | |
} | |
@Test | |
public void testUrl2MountWhenStringIsSomething() throws Exception { | |
String urlStr = "something"; | |
String expected = "null:" + urlStr; | |
String actual = NfsUtils.url2Mount(urlStr); | |
assertEquals(expected, actual); | |
} | |
@Test | |
public void testUrl2MountWhenStringHasHostAndPath() throws Exception { | |
String urlStr = "host/path"; | |
String expected = "null:" + urlStr; | |
String actual = NfsUtils.url2Mount(urlStr); | |
assertEquals(expected, actual); | |
} | |
@Test | |
public void testUrl2MountWhenStringHasProtocolHostAndPath() throws Exception { | |
String urlStr = "smb://host/path"; | |
String expected = "host:/path"; | |
String actual = NfsUtils.url2Mount(urlStr); | |
assertEquals(expected, actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment