001: /*
002: * @(#)ExtensionFileFilterJDK12UTest.java
003: *
004: * Copyright (C) 2001,,2003 2002 Matt Albrecht
005: * groboclown@users.sourceforge.net
006: * http://groboutils.sourceforge.net
007: *
008: * Permission is hereby granted, free of charge, to any person obtaining a
009: * copy of this software and associated documentation files (the "Software"),
010: * to deal in the Software without restriction, including without limitation
011: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
012: * and/or sell copies of the Software, and to permit persons to whom the
013: * Software is furnished to do so, subject to the following conditions:
014: *
015: * The above copyright notice and this permission notice shall be included in
016: * all copies or substantial portions of the Software.
017: *
018: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
019: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
020: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
021: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
022: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
023: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
024: * DEALINGS IN THE SOFTWARE.
025: */
026:
027: package net.sourceforge.groboutils.util.io.v1;
028:
029: import java.io.File;
030:
031: import junit.framework.Test;
032: import junit.framework.TestCase;
033: import junit.framework.TestSuite;
034:
035: /**
036: *
037: *
038: * @author Matt Albrecht <a href="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
039: * @since 0.9.1d Alpha (sometime in 2001)
040: * @version $Date: 2003/02/10 22:52:45 $
041: */
042: public class ExtensionFileFilterJDK12UTest extends
043: ExtensionFilenameFilterUTest {
044: //-------------------------------------------------------------------------
045: // Global constructs that only depend upon the class name
046: private static final Class THIS_CLASS = ExtensionFileFilterJDK12UTest.class;
047:
048: public ExtensionFileFilterJDK12UTest(String name) {
049: super (name);
050: }
051:
052: //-------------------------------------------------------------------------
053: // Test methods
054:
055: public void testNullAccept1a() {
056: try {
057: ((ExtensionFileFilter) createFilter("a")).accept(null);
058: fail("Did not throw IllegalArgumentException.");
059: } catch (IllegalArgumentException e) {
060: }
061: }
062:
063: protected void matchFile(ExtensionFilenameFilter eff, File f) {
064: super .matchFile(eff, f);
065: assertTrue("Filter must accept file " + f + ".",
066: ((ExtensionFileFilter) eff).accept(f));
067: }
068:
069: protected void noMatchFile(ExtensionFilenameFilter eff, File f) {
070: super .noMatchFile(eff, f);
071: assertTrue("Filter must not accept file " + f + ".",
072: !((ExtensionFileFilter) eff).accept(f));
073: }
074:
075: protected ExtensionFilenameFilter createFilter() {
076: return new ExtensionFileFilter();
077: }
078:
079: protected ExtensionFilenameFilter createFilter(String s) {
080: return new ExtensionFileFilter(s);
081: }
082:
083: protected ExtensionFilenameFilter createFilter(String s[]) {
084: return new ExtensionFileFilter(s);
085: }
086:
087: protected ExtensionFilenameFilter createFilter(boolean b) {
088: return new ExtensionFileFilter(b);
089: }
090:
091: protected ExtensionFilenameFilter createFilter(String s, boolean b) {
092: return new ExtensionFileFilter(s, b);
093: }
094:
095: protected ExtensionFilenameFilter createFilter(String s[], boolean b) {
096: return new ExtensionFileFilter(s, b);
097: }
098:
099: //-------------------------------------------------------------------------
100: // Global static methods that don't change.
101:
102: public static Test suite() {
103: TestSuite suite = new TestSuite(THIS_CLASS);
104:
105: return suite;
106: }
107:
108: public static void main(String[] args) {
109: String[] name = { THIS_CLASS.getName() };
110:
111: // junit.textui.TestRunner.main( name );
112: // junit.swingui.TestRunner.main( name );
113:
114: junit.textui.TestRunner.main(name);
115: }
116:
117: protected void setUp() throws Exception {
118: super .setUp();
119:
120: // set ourself up
121: }
122:
123: protected void tearDown() throws Exception {
124: // tear ourself down
125:
126: super.tearDown();
127: }
128:
129: }
|