Skip to content
Snippets Groups Projects
Commit 7537edcb authored by felmer's avatar felmer
Browse files

LMS-2265 tests fixed

SVN: 21521
parent 817b00b0
No related branches found
No related tags found
Loading
......@@ -128,4 +128,12 @@ public class ImageReaderFactory
{
libraries = newLibraries;
}
/**
* used only for testing purposes.
*/
static List<IImageReaderLibrary> getLibraries()
{
return libraries;
}
}
......@@ -90,11 +90,12 @@ public class ImageReaderFactoryTest extends ImageReaderTestCase
}
@Test(expectedExceptions = IOExceptionUnchecked.class)
public void testReadNonExistingFile()
public void testReadNonExistingFile() throws Exception
{
final String invalidName = "invalid_file_path.jpg";
final File invalidFile = new File(invalidName);
ImageReadersTestHelper.setUpLibraries(ImageReaderConstants.BIOFORMATS_LIBRARY);
IImageReader reader =
ImageReaderFactory.tryGetReaderForFile(BIOFORMATS_LIBRARY, invalidName);
reader.readImage(invalidFile, ImageID.NULL, null);
......
......@@ -17,8 +17,11 @@
package ch.systemsx.cisd.imagereaders;
import java.io.File;
import java.util.List;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
/**
* Common super class for unit test using example image files.
......@@ -34,6 +37,19 @@ public abstract class ImageReaderTestCase extends AssertJUnit
protected static final String INVALID_SUBDIR = "invalid";
private List<IImageReaderLibrary> libraries;
@BeforeMethod
public void setUp()
{
libraries = ImageReaderFactory.getLibraries();
}
@AfterMethod
public void tearDown()
{
ImageReaderFactory.setLibraries(libraries);
}
protected File getImageFileForLibrary(String libraryName, String fileName)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment