samples/individualsamples/test/org/apidesign/samples/FileSystemLikeTCK.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 30 Oct 2014 20:46:27 +0100
changeset 408 9a439a79c6d0
parent 144 cef9a41a770a
permissions -rw-r--r--
Use scala 2.10.4 to compile on JDK8
     1 package org.apidesign.samples;
     2 
     3 import java.io.File;
     4 import java.io.IOException;
     5 import junit.framework.Test;
     6 import org.netbeans.junit.NbTestCase;
     7 import org.netbeans.junit.NbTestSetup;
     8 import org.netbeans.junit.NbTestSuite;
     9 import org.openide.filesystems.FileSystem;
    10 import org.openide.filesystems.JarFileSystem;
    11 
    12 public class FileSystemLikeTCK {
    13     // BEGIN: tck.factory
    14     public static abstract class FileSystemFactoryHid extends NbTestSetup {
    15         public FileSystemFactoryHid(Test testToDecorate) {
    16             super(testToDecorate);
    17         }
    18         
    19         protected abstract FileSystem createFileSystem(
    20             String testName, String[] resources
    21         ) throws Exception;
    22         protected abstract void destroyFileSystem(
    23             String testName
    24         ) throws IOException;
    25     }
    26     // END: tck.factory
    27     
    28 
    29     // BEGIN: tck.setup
    30     public static class JarFileSystemTest extends FileSystemFactoryHid {
    31         public JarFileSystemTest(Test testToDecorate) {
    32             super(testToDecorate);
    33         }
    34 
    35         public static Test suite() {
    36             NbTestSuite suite = new NbTestSuite();
    37             suite.addTestSuite(RepositoryTestHid.class);
    38             suite.addTestSuite(FileSystemTestHid.class);
    39             suite.addTestSuite(FileObjectTestHid.class);
    40             return new JarFileSystemTest(suite);
    41         }
    42 
    43         protected void destroyFileSystem(String testName) throws IOException {
    44         }
    45 
    46         protected FileSystem createFileSystem(
    47             String testName, String[] resources
    48         ) throws Exception {
    49             JarFileSystem fs = new JarFileSystem();
    50             fs.setJarFile(createJarFile(testName, resources));
    51             return fs;
    52         }
    53     }
    54     // END: tck.setup
    55     
    56     static File createJarFile(String name, String[] resources) {
    57         return null;
    58     }
    59     
    60     public static final class RepositoryTestHid extends NbTestCase {
    61         public RepositoryTestHid(String name) {
    62             super(name);
    63         }
    64         
    65     }
    66     public static final class FileSystemTestHid extends NbTestCase {
    67         public FileSystemTestHid(String name) {
    68             super(name);
    69         }
    70         
    71     }
    72     public static final class FileObjectTestHid extends NbTestCase {
    73         public FileObjectTestHid(String name) {
    74             super(name);
    75         }
    76     }
    77 }