edit unit test

This commit is contained in:
tienvn 2023-07-10 22:42:12 +07:00
parent cd4167c462
commit 5f24d80f3d
1 changed files with 10 additions and 5 deletions

View File

@ -5,40 +5,45 @@ import org.junit.Test;
public class RelativePathConverterUnitTest {
@Test
public void testConvertToAbsolutePath() {
public void givenRelativePath_whenConvertingToAbsolutePath_thenPrintOutput() {
String relativePath = "data/sample.txt";
System.out.println(RelativePathConverter.convertToAbsoluteUsePathsClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileSystemsClass(relativePath));
}
@Test
public void testConvertToAbsolutePath_withAbsolutePath() {
public void givenAbsolutePath_whenConvertingToAbsolutePath_thenPrintOutput() {
String absolutePath = "/var/www/index.html";
System.out.println(RelativePathConverter.convertToAbsoluteUsePathsClass(absolutePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileClass(absolutePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileSystemsClass(absolutePath));
}
@Test
public void testConvertToAbsolutePath_withEmptyPath() {
public void givenEmptyPath_whenConvertingToAbsolutePath_thenPrintOutput() {
String emptyPath = "";
System.out.println(RelativePathConverter.convertToAbsoluteUsePathsClass(emptyPath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileClass(emptyPath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileSystemsClass(emptyPath));
}
@Test
public void testConvertToAbsolutePath_withParentDirectory() {
public void givenParentDirectoryPath_whenConvertingToAbsolutePath_thenPrintOutput() {
String relativePath = "../data/sample.txt";
System.out.println(RelativePathConverter.convertToAbsoluteUsePathsClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileSystemsClass(relativePath));
}
@Test
public void testConvertToAbsolutePath_withRelativePathContainingDots() {
public void givenRelativePathContainingDots_whenConvertingToAbsolutePath_thenPrintOutput() {
String relativePath = "././data/sample.txt";
System.out.println(RelativePathConverter.convertToAbsoluteUsePathsClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileClass(relativePath));
System.out.println(RelativePathConverter.convertToAbsoluteUseFileSystemsClass(relativePath));