Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
FIX JENKINS-19877
Disabled two of the unit tests that are using Java 7 API.
  • Loading branch information
msiemczyk committed Oct 23, 2013
1 parent 1b60618 commit 2f32af6
Showing 1 changed file with 20 additions and 7 deletions.
Expand Up @@ -24,17 +24,17 @@
package com.thalesgroup.hudson.plugins.xunit.service;

import java.io.*;
import java.nio.file.*;
import java.nio.file.FileSystem;

//import java.nio.file.*;
//import java.nio.file.FileSystem;
import org.junit.*;

import com.thalesgroup.hudson.plugins.xunit.transformer.TempWorkspace;

/**
* Unit tests for XUnitValidationService class.
*
* @author Maciek Siemczyk
*
* @note Two of the unit tests were disabled as they require Java 7 API.
*/
public class XUnitValidationServiceTest
{
Expand All @@ -50,9 +50,10 @@ public class XUnitValidationServiceTest
private XUnitValidationService xUnitValidationService = new XUnitValidationService();

@Test
public void CheckFileIsNotEmpty_GivenEmptyFile_ReturnsFalse()
public void CheckFileIsNotEmpty_GivenEmptyFile_ReturnsFalse() throws Exception
{
File testFile = new File(tempWorkspace.getDir(), "empty.txt");
testFile.createNewFile();

Assert.assertFalse(
"CheckFileIsNotEmpty returned true.",
Expand All @@ -70,35 +71,47 @@ public void CheckFileIsNotEmpty_GivenNotEmptyFile_ReturnsTrue() throws Exception
}

@Test
@Ignore
public void CheckFileIsNotEmpty_GivenLinkToEmptyFile_ReturnsFalse() throws Exception
{
/**
* This unit test is disabled as it required Java 7 API.
FileSystem filesystem = FileSystems.getDefault();
File targetFile = new File(tempWorkspace.getDir(), "empty.txt");;
targetFile.createNewFile();
Path targetPath = filesystem.getPath(targetFile.getPath());
Path linkPath = filesystem.getPath(tempWorkspace.getDir().getPath(), "linkToNotEmpty.txt");
Path linkPath = filesystem.getPath(tempWorkspace.getDir().getPath(), "link.txt");
Files.createSymbolicLink(linkPath, targetPath);
Assert.assertFalse(
"CheckFileIsNotEmpty returned true.",
xUnitValidationService.checkFileIsNotEmpty(linkPath.toFile()));
*/
}

@Test
@Ignore
public void CheckFileIsNotEmpty_GivenLinkToNotEmptyFile_ReturnsTrue() throws Exception
{
/**
* This unit test is disabled as it required Java 7 API.
FileSystem filesystem = FileSystems.getDefault();
File targetFile = CreateNotEmtyFile();
Path targetPath = filesystem.getPath(targetFile.getPath());
Path linkPath = filesystem.getPath(tempWorkspace.getDir().getPath(), "linkToNotEmpty.txt");
Path linkPath = filesystem.getPath(tempWorkspace.getDir().getPath(), "link.txt");
Files.createSymbolicLink(linkPath, targetPath);
Assert.assertTrue(
"CheckFileIsNotEmpty returned false.",
xUnitValidationService.checkFileIsNotEmpty(linkPath.toFile()));
*/
}

/**
Expand Down

0 comments on commit 2f32af6

Please sign in to comment.