relocate code from core-java-modules/java.nio packageto core-java-modules/core-java-io-apis-2. (#13614)

This commit is contained in:
ACHRAF TAITAI
2023-03-11 19:47:58 +01:00
committed by GitHub
parent d0c478065f
commit 5479a122f5

View File

@@ -0,0 +1,29 @@
package com.baeldung.path;
import org.junit.jupiter.api.Test;
import java.io.File;
import static org.junit.Assert.assertEquals;
import javax.swing.filechooser.FileSystemView;
public class DesktopPathUnitTest {
// Adapt DESKTOP_PATH variable to your own system path
// private static final String DESKTOP_PATH = "C:\\Users\\HRAF\\Desktop";
@Test
public void whenUsingGetUserHomeProperty_thenShouldEqualDesktopPath() {
String desktopPath = System.getProperty("user.home") + File.separator + "Desktop";
// assertEquals(DESKTOP_PATH, desktopPath);
}
@Test
public void whenUsingFileSystemViewGetHomeDirectory_thenShouldEqualDesktopPath() {
FileSystemView view = FileSystemView.getFileSystemView();
File file = view.getHomeDirectory();
String path = file.getPath();
// assertEquals(DESKTOP_PATH, path);
}
}