package at.jku.pervasive.ecg.wfdb;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;

import junit.framework.TestCase;

public class PhysioToolkitTestCase extends TestCase {

  protected PhysioToolkit physioToolkit;

  public void testIsPhysioToolkitInstalled() throws Exception {
    assertTrue(physioToolkit.isInstalled());
  }

  protected File getFile(String path) throws URISyntaxException {
    URL url = this.getClass().getResource(path);
    return new File(url.toURI());
  }

  @Override
  protected void setUp() throws Exception {
    physioToolkit = new PhysioToolkit();
  }

  @Override
  protected void tearDown() throws Exception {
    physioToolkit = null;
  }

}

@@ -142,16 +142,61 @@
 tCase;%0A%0A
+import org.apache.commons.io.FilenameUtils;%0A%0A
 public c
@@ -306,250 +306,884 @@
 test
-IsPhysioToolkitInstalled() throws Exception %7B%0A    assertTrue(physioToolkit.isInstalled());%0A  %7D%0A%0A  protected File getFile(String path) throws URISyntaxException %7B%0A    URL url = this.getClass().getResource(path);%0A    return new File(url.toURI()
+GetFile() throws Exception %7B%0A    File file = getFile(%22/chf03.dat%22);%0A    assertNotNull(file);%0A    assertEquals(%22chf03.dat%22, file.getName());%0A  %7D%0A%0A  public void testGetWFDBFile() throws Exception %7B%0A    File wfdbFile = getWFDBFile(%22/chf03.dat%22);%0A    assertNotNull(wfdbFile);%0A    assertEquals(%22chf03%22, wfdbFile.getName());%0A  %7D%0A%0A  public void testIsPhysioToolkitInstalled() throws Exception %7B%0A    assertTrue(physioToolkit.isInstalled());%0A  %7D%0A%0A  protected File getFile(String path) throws URISyntaxException %7B%0A    URL url = this.getClass().getResource(path);%0A    return new File(url.toURI());%0A  %7D%0A%0A  protected File getWFDBFile(String pathToDat) throws URISyntaxException %7B%0A    URL url = this.getClass().getResource(pathToDat);%0A    File datFile = new File(url.toURI());%0A    String wfdbFile = FilenameUtils.getBaseName(pathToDat);%0A    return new File(datFile.getParentFile(), wfdbFile
 );%0A 

add convenience method to get WFDB compatible file for a dat file