Skip to content

Commit 512334f

Browse files
committed
refactored so that more tests use TestUtils.isExecutingOnWindows()
1 parent 70103a0 commit 512334f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/test/java/gov/loc/repository/bagit/TestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static boolean isExecutingOnWindows(){
1313
}
1414

1515
public static void makeFilesHiddenOnWindows(Path startingDir) throws IOException {
16-
if (System.getProperty("os.name").contains("Windows")) {
16+
if (isExecutingOnWindows()) {
1717
Files.walkFileTree(startingDir, new SimpleFileVisitor<Path>() {
1818
@Override
1919
public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException{

src/test/java/gov/loc/repository/bagit/creator/AddPayloadToBagManifestVistorTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.junit.Test;
1616
import org.junit.rules.TemporaryFolder;
1717

18+
import gov.loc.repository.bagit.TestUtils;
1819
import gov.loc.repository.bagit.domain.Manifest;
1920
import gov.loc.repository.bagit.hash.StandardSupportedAlgorithms;
2021

@@ -74,7 +75,7 @@ public void testSkipHiddenFile() throws IOException{
7475
private Path createHiddenDirectory() throws IOException{
7576
Path hiddenDirectory = Paths.get(folder.newFolder(".someHiddenDir").toURI());
7677

77-
if(System.getProperty("os.name").contains("Windows")){
78+
if(TestUtils.isExecutingOnWindows()){
7879
Files.setAttribute(hiddenDirectory, "dos:hidden", Boolean.TRUE);
7980
}
8081

@@ -84,7 +85,7 @@ private Path createHiddenDirectory() throws IOException{
8485
private Path createHiddenFile() throws IOException{
8586
Path hiddenDirectory = Paths.get(folder.newFile(".someHiddenFile").toURI());
8687

87-
if(System.getProperty("os.name").contains("Windows")){
88+
if(TestUtils.isExecutingOnWindows()){
8889
Files.setAttribute(hiddenDirectory, "dos:hidden", Boolean.TRUE);
8990
}
9091

0 commit comments

Comments
 (0)