commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1680742 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
Date Thu, 21 May 2015 06:38:49 GMT
Author: britter
Date: Thu May 21 06:38:48 2015
New Revision: 1680742

URL: http://svn.apache.org/r1680742
Log:
Format source code

Modified:
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java?rev=1680742&r1=1680741&r2=1680742&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
(original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/filefilter/ConditionalFileFilterAbstractTestCase.java
Thu May 21 06:38:48 2015
@@ -20,149 +20,157 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
-public abstract class ConditionalFileFilterAbstractTestCase
-  extends IOFileFilterAbstractTestCase {
+public abstract class ConditionalFileFilterAbstractTestCase extends IOFileFilterAbstractTestCase
{
 
-  private static final String TEST_FILE_NAME_PREFIX = "TestFile";
-  private static final String TEST_FILE_TYPE = ".tst";
+    private static final String TEST_FILE_NAME_PREFIX = "TestFile";
+    private static final String TEST_FILE_TYPE = ".tst";
 
-  protected TesterTrueFileFilter[] trueFilters;
-  protected TesterFalseFileFilter[] falseFilters;
+    protected TesterTrueFileFilter[] trueFilters;
+    protected TesterFalseFileFilter[] falseFilters;
 
-  private File file;
-  private File workingPath;
-
-  public ConditionalFileFilterAbstractTestCase(final String name) {
-    super(name);
-  }
-
-  @Override
-  public void setUp() throws Exception {
-    this.workingPath = determineWorkingDirectoryPath(this.getWorkingPathNamePropertyKey(),
this.getDefaultWorkingPath());
-    this.file = new File(this.workingPath, TEST_FILE_NAME_PREFIX + 1 + TEST_FILE_TYPE);
-    this.trueFilters = new TesterTrueFileFilter[4];
-    this.falseFilters = new TesterFalseFileFilter[4];
-    this.trueFilters[1] = new TesterTrueFileFilter();
-    this.trueFilters[2] = new TesterTrueFileFilter();
-    this.trueFilters[3] = new TesterTrueFileFilter();
-    this.falseFilters[1] = new TesterFalseFileFilter();
-    this.falseFilters[2] = new TesterFalseFileFilter();
-    this.falseFilters[3] = new TesterFalseFileFilter();
-  }
-
-  public void testAdd() {
-    final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
-    final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    for(int i = 0; i < filters.size(); i++) {
-      assertEquals("file filters count: ", i, fileFilter.getFileFilters().size());
-      fileFilter.addFileFilter(filters.get(i));
-      assertEquals("file filters count: ", i+1, fileFilter.getFileFilters().size());
-    }
-    for (final IOFileFilter filter : fileFilter.getFileFilters()) {
-      assertTrue("found file filter", filters.contains(filter));
-    }
-    assertEquals("file filters count", filters.size(), fileFilter.getFileFilters().size());
-  }
-
-  public void testRemove() {
-    final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
-    final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    filters.add(new TesterTrueFileFilter());
-    for (TesterTrueFileFilter filter : filters) {
-      fileFilter.removeFileFilter(filter);
-      assertTrue("file filter removed", !fileFilter.getFileFilters().contains(filter));
-    }
-    assertEquals("file filters count", 0, fileFilter.getFileFilters().size());
-  }
-
-  public void testNoFilters() throws Exception {
-    final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
-    final File file = new File(this.workingPath, TEST_FILE_NAME_PREFIX + 1 + TEST_FILE_TYPE);
-    assertFileFiltering(1, (IOFileFilter) fileFilter, file, false);
-    assertFilenameFiltering(1, (IOFileFilter) fileFilter, file, false);
-  }
-
-  public void testFilterBuiltUsingConstructor() throws Exception {
-    final List<List<IOFileFilter>> testFilters = this.getTestFilters();
-    final List<boolean []> testTrueResults = this.getTrueResults();
-    final List<boolean []> testFalseResults = this.getFalseResults();
-    final List<Boolean> testFileResults = this.getFileResults();
-    final List<Boolean> testFilenameResults = this.getFilenameResults();
-
-    for(int i = 1; i < testFilters.size(); i++) {
-      final List<IOFileFilter> filters = testFilters.get(i);
-      final boolean[] trueResults = testTrueResults.get(i);
-      final boolean[] falseResults = testFalseResults.get(i);
-      final boolean fileResults = testFileResults.get(i).booleanValue();
-      final boolean filenameResults = testFilenameResults.get(i).booleanValue();
-
-      // Test conditional AND filter created by passing filters to the constructor
-      final IOFileFilter filter = this.buildFilterUsingConstructor(filters);
-
-      // Test as a file filter
-      resetTrueFilters(this.trueFilters);
-      resetFalseFilters(this.falseFilters);
-      assertFileFiltering(i, filter, this.file, fileResults);
-      assertTrueFiltersInvoked(i, trueFilters, trueResults);
-      assertFalseFiltersInvoked(i, falseFilters, falseResults);
-
-      // Test as a filename filter
-      resetTrueFilters(this.trueFilters);
-      resetFalseFilters(this.falseFilters);
-      assertFilenameFiltering(i, filter, this.file, filenameResults);
-      assertTrueFiltersInvoked(i, trueFilters, trueResults);
-      assertFalseFiltersInvoked(i, falseFilters, falseResults);
-    }
-  }
-
-  public void testFilterBuiltUsingAdd() throws Exception {
-    final List<List<IOFileFilter>> testFilters = this.getTestFilters();
-    final List<boolean[]> testTrueResults = this.getTrueResults();
-    final List<boolean[]> testFalseResults = this.getFalseResults();
-    final List<Boolean> testFileResults = this.getFileResults();
-    final List<Boolean> testFilenameResults = this.getFilenameResults();
-
-    for(int i = 1; i < testFilters.size(); i++) {
-      final List<IOFileFilter> filters = testFilters.get(i);
-      final boolean[] trueResults = testTrueResults.get(i);
-      final boolean[] falseResults = testFalseResults.get(i);
-      final boolean fileResults = testFileResults.get(i).booleanValue();
-      final boolean filenameResults = testFilenameResults.get(i).booleanValue();
-
-      // Test conditional AND filter created by passing filters to the constructor
-      final IOFileFilter filter = this.buildFilterUsingAdd(filters);
-
-      // Test as a file filter
-      resetTrueFilters(this.trueFilters);
-      resetFalseFilters(this.falseFilters);
-      assertFileFiltering(i, filter, this.file, fileResults);
-      assertTrueFiltersInvoked(i, trueFilters, trueResults);
-      assertFalseFiltersInvoked(i, falseFilters, falseResults);
-
-      // Test as a filename filter
-      resetTrueFilters(this.trueFilters);
-      resetFalseFilters(this.falseFilters);
-      assertFilenameFiltering(i, filter, this.file, filenameResults);
-      assertTrueFiltersInvoked(i, trueFilters, trueResults);
-      assertFalseFiltersInvoked(i, falseFilters, falseResults);
-    }
-  }
-
-  protected abstract ConditionalFileFilter getConditionalFileFilter();
-  protected abstract IOFileFilter buildFilterUsingAdd(List<IOFileFilter> filters);
-  protected abstract IOFileFilter buildFilterUsingConstructor(List<IOFileFilter> filters);
-  protected abstract List<List<IOFileFilter>> getTestFilters();
-  protected abstract List<boolean[]> getTrueResults();
-  protected abstract List<boolean[]> getFalseResults();
-  protected abstract List<Boolean> getFileResults();
-  protected abstract List<Boolean> getFilenameResults();
-  protected abstract String getWorkingPathNamePropertyKey();
-  protected abstract String getDefaultWorkingPath();
+    private File file;
+    private File workingPath;
+
+    public ConditionalFileFilterAbstractTestCase(final String name) {
+        super(name);
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        this.workingPath = determineWorkingDirectoryPath(this.getWorkingPathNamePropertyKey(),
this.getDefaultWorkingPath());
+        this.file = new File(this.workingPath, TEST_FILE_NAME_PREFIX + 1 + TEST_FILE_TYPE);
+        this.trueFilters = new TesterTrueFileFilter[4];
+        this.falseFilters = new TesterFalseFileFilter[4];
+        this.trueFilters[1] = new TesterTrueFileFilter();
+        this.trueFilters[2] = new TesterTrueFileFilter();
+        this.trueFilters[3] = new TesterTrueFileFilter();
+        this.falseFilters[1] = new TesterFalseFileFilter();
+        this.falseFilters[2] = new TesterFalseFileFilter();
+        this.falseFilters[3] = new TesterFalseFileFilter();
+    }
+
+    public void testAdd() {
+        final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
+        final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        for (int i = 0; i < filters.size(); i++) {
+            assertEquals("file filters count: ", i, fileFilter.getFileFilters().size());
+            fileFilter.addFileFilter(filters.get(i));
+            assertEquals("file filters count: ", i + 1, fileFilter.getFileFilters().size());
+        }
+        for (final IOFileFilter filter : fileFilter.getFileFilters()) {
+            assertTrue("found file filter", filters.contains(filter));
+        }
+        assertEquals("file filters count", filters.size(), fileFilter.getFileFilters().size());
+    }
+
+    public void testRemove() {
+        final List<TesterTrueFileFilter> filters = new ArrayList<TesterTrueFileFilter>();
+        final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        filters.add(new TesterTrueFileFilter());
+        for (TesterTrueFileFilter filter : filters) {
+            fileFilter.removeFileFilter(filter);
+            assertTrue("file filter removed", !fileFilter.getFileFilters().contains(filter));
+        }
+        assertEquals("file filters count", 0, fileFilter.getFileFilters().size());
+    }
+
+    public void testNoFilters() throws Exception {
+        final ConditionalFileFilter fileFilter = this.getConditionalFileFilter();
+        final File file = new File(this.workingPath, TEST_FILE_NAME_PREFIX + 1 + TEST_FILE_TYPE);
+        assertFileFiltering(1, (IOFileFilter) fileFilter, file, false);
+        assertFilenameFiltering(1, (IOFileFilter) fileFilter, file, false);
+    }
+
+    public void testFilterBuiltUsingConstructor() throws Exception {
+        final List<List<IOFileFilter>> testFilters = this.getTestFilters();
+        final List<boolean[]> testTrueResults = this.getTrueResults();
+        final List<boolean[]> testFalseResults = this.getFalseResults();
+        final List<Boolean> testFileResults = this.getFileResults();
+        final List<Boolean> testFilenameResults = this.getFilenameResults();
+
+        for (int i = 1; i < testFilters.size(); i++) {
+            final List<IOFileFilter> filters = testFilters.get(i);
+            final boolean[] trueResults = testTrueResults.get(i);
+            final boolean[] falseResults = testFalseResults.get(i);
+            final boolean fileResults = testFileResults.get(i).booleanValue();
+            final boolean filenameResults = testFilenameResults.get(i).booleanValue();
+
+            // Test conditional AND filter created by passing filters to the constructor
+            final IOFileFilter filter = this.buildFilterUsingConstructor(filters);
+
+            // Test as a file filter
+            resetTrueFilters(this.trueFilters);
+            resetFalseFilters(this.falseFilters);
+            assertFileFiltering(i, filter, this.file, fileResults);
+            assertTrueFiltersInvoked(i, trueFilters, trueResults);
+            assertFalseFiltersInvoked(i, falseFilters, falseResults);
+
+            // Test as a filename filter
+            resetTrueFilters(this.trueFilters);
+            resetFalseFilters(this.falseFilters);
+            assertFilenameFiltering(i, filter, this.file, filenameResults);
+            assertTrueFiltersInvoked(i, trueFilters, trueResults);
+            assertFalseFiltersInvoked(i, falseFilters, falseResults);
+        }
+    }
+
+    public void testFilterBuiltUsingAdd() throws Exception {
+        final List<List<IOFileFilter>> testFilters = this.getTestFilters();
+        final List<boolean[]> testTrueResults = this.getTrueResults();
+        final List<boolean[]> testFalseResults = this.getFalseResults();
+        final List<Boolean> testFileResults = this.getFileResults();
+        final List<Boolean> testFilenameResults = this.getFilenameResults();
+
+        for (int i = 1; i < testFilters.size(); i++) {
+            final List<IOFileFilter> filters = testFilters.get(i);
+            final boolean[] trueResults = testTrueResults.get(i);
+            final boolean[] falseResults = testFalseResults.get(i);
+            final boolean fileResults = testFileResults.get(i).booleanValue();
+            final boolean filenameResults = testFilenameResults.get(i).booleanValue();
+
+            // Test conditional AND filter created by passing filters to the constructor
+            final IOFileFilter filter = this.buildFilterUsingAdd(filters);
+
+            // Test as a file filter
+            resetTrueFilters(this.trueFilters);
+            resetFalseFilters(this.falseFilters);
+            assertFileFiltering(i, filter, this.file, fileResults);
+            assertTrueFiltersInvoked(i, trueFilters, trueResults);
+            assertFalseFiltersInvoked(i, falseFilters, falseResults);
+
+            // Test as a filename filter
+            resetTrueFilters(this.trueFilters);
+            resetFalseFilters(this.falseFilters);
+            assertFilenameFiltering(i, filter, this.file, filenameResults);
+            assertTrueFiltersInvoked(i, trueFilters, trueResults);
+            assertFalseFiltersInvoked(i, falseFilters, falseResults);
+        }
+    }
+
+    protected abstract ConditionalFileFilter getConditionalFileFilter();
+
+    protected abstract IOFileFilter buildFilterUsingAdd(List<IOFileFilter> filters);
+
+    protected abstract IOFileFilter buildFilterUsingConstructor(List<IOFileFilter>
filters);
+
+    protected abstract List<List<IOFileFilter>> getTestFilters();
+
+    protected abstract List<boolean[]> getTrueResults();
+
+    protected abstract List<boolean[]> getFalseResults();
+
+    protected abstract List<Boolean> getFileResults();
+
+    protected abstract List<Boolean> getFilenameResults();
+
+    protected abstract String getWorkingPathNamePropertyKey();
+
+    protected abstract String getDefaultWorkingPath();
 }



Mime
View raw message