View Javadoc
1 /* 2 Java Regular Expressions Plugin API 3 4 Copyright (C) 2002 Jose San Leandro Armend?riz 5 jsanleandro@yahoo.es 6 chousz@yahoo.com 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public 10 License as published by the Free Software Foundation; either 11 version 2.1 of the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 23 Thanks to ACM S.L. for distributing this library under the LGPL license. 24 Contact info: jsr000@terra.es 25 Postal Address: c/Playa de Lagoa, 1 26 Urb. Valdecaba?as 27 Boadilla del monte 28 28660 Madrid 29 Spain 30 31 This library uses an external API to retrieve version information at 32 runtime. 33 So far I haven't released such API as a project itself, but you should be 34 able to download it from the web page where you got this source code. 35 36 ****************************************************************************** 37 * 38 * Filename: $RCSfile: RegexpManagerTest.java,v $ 39 * 40 * Author: Jose San Leandro Armend?riz 41 * 42 * Description: Performs some unit tests on RegexpManager class. 43 * 44 * Last modified by: $Author: chous $ at $Date: 2003/06/21 21:07:26 $ 45 * 46 * File version: $Revision: 1.4 $ 47 * 48 * Project version: $Name: $ 49 * ("Name" means no concrete version has been checked out) 50 * 51 * $Id: RegexpManagerTest.java,v 1.4 2003/06/21 21:07:26 chous Exp $ 52 * 53 */ 54 package unittests.org.acmsl.regexpplugin; 55 56 /* 57 * Importing project-specific classes. 58 */ 59 import org.acmsl.regexpplugin.Compiler; 60 import org.acmsl.regexpplugin.gnuregexp.CompilerGNUAdapter; 61 import org.acmsl.regexpplugin.jakartaoro.AwkCompilerOROAdapter; 62 import org.acmsl.regexpplugin.jakartaoro.HelperOROAdapter; 63 import org.acmsl.regexpplugin.jakartaoro.Perl5CompilerOROAdapter; 64 import org.acmsl.regexpplugin.jakartaregexp.CompilerRegexpAdapter; 65 import org.acmsl.regexpplugin.jdk14regexp.CompilerJDKAdapter; 66 import org.acmsl.regexpplugin.Helper; 67 import org.acmsl.regexpplugin.RegexpEngineNotFoundException; 68 import org.acmsl.regexpplugin.RegexpManager; 69 70 /* 71 * Importing some ACM classes. 72 */ 73 import org.acmsl.version.Version; 74 import org.acmsl.version.VersionFactory; 75 76 /*** 77 * Importing JUnit classes. 78 */ 79 import junit.framework.TestCase; 80 81 /*** 82 * Performs some unit tests on RegexpManager class. 83 * @testfamily JUnit 84 * @testkind testcase 85 * @testsetup Default TestCase 86 * @testedclass org.acm.regexpplugin.RegexpManager 87 * @see org.acmsl.regexpplugin.RegexpManager 88 * @author <a href="mailto:jsanleandro@yahoo.es" 89 >Jose San Leandro Armend?riz</a> 90 * @version $Revision: 1.4 $ 91 */ 92 public class RegexpManagerTest 93 extends TestCase 94 implements org.acmsl.patterns.Test 95 { 96 /*** 97 * Constructs a test case with the given name. 98 * @param name the test case name. 99 */ 100 public RegexpManagerTest(String name) 101 { 102 super(name); 103 } 104 105 /*** 106 * Tests the RegexpManager.createCompiler() method. 107 * @see org.acmsl.regexpplugin.RegexpManager 108 */ 109 public void testCreateOroPerlCompiler() 110 { 111 try 112 { 113 RegexpManager.useJakartaOroPerl5(); 114 115 Compiler t_Compiler = RegexpManager.createCompiler(); 116 117 assertTrue(t_Compiler != null); 118 119 assertTrue(t_Compiler instanceof Perl5CompilerOROAdapter); 120 } 121 catch (RegexpEngineNotFoundException regexpEngineNotFoundException) 122 { 123 assertTrue("Regexp engine not found.", false); 124 } 125 } 126 127 /*** 128 * Tests the RegexpManager.createCompiler() method. 129 * @see org.acmsl.regexpplugin.RegexpManager 130 */ 131 public void testCreateJakartaRegexpCompiler() 132 { 133 try 134 { 135 RegexpManager.useJakartaRegexp(); 136 137 Compiler t_Compiler = RegexpManager.createCompiler(); 138 139 assertTrue(t_Compiler != null); 140 141 assertTrue(t_Compiler instanceof CompilerRegexpAdapter); 142 } 143 catch (RegexpEngineNotFoundException regexpEngineNotFoundException) 144 { 145 assertTrue("Regexp engine not found.", false); 146 } 147 } 148 149 /*** 150 * Tests the RegexpManager.createCompiler() method. 151 * @see org.acmsl.regexpplugin.RegexpManager 152 */ 153 public void testCreateJDK14Compiler() 154 { 155 try 156 { 157 RegexpManager.useGNURegexp(); 158 159 Compiler t_Compiler = RegexpManager.createCompiler(); 160 161 assertTrue(t_Compiler != null); 162 163 assertTrue(t_Compiler instanceof CompilerGNUAdapter); 164 } 165 catch (RegexpEngineNotFoundException regexpEngineNotFoundException) 166 { 167 assertTrue("Regexp engine not found.", false); 168 } 169 } 170 171 /*** 172 * Tests the RegexpManager.createHelper() method. 173 * @see org.acmsl.regexpplugin.RegexpManager 174 */ 175 public void testCreateOroPerlHelper() 176 { 177 try 178 { 179 RegexpManager.useJakartaOroPerl5(); 180 181 Helper t_Helper = RegexpManager.createHelper(); 182 183 assertTrue(t_Helper != null); 184 185 assertTrue(t_Helper instanceof HelperOROAdapter); 186 } 187 catch (RegexpEngineNotFoundException regexpEngineNotFoundException) 188 { 189 assertTrue("Regexp engine not found.", false); 190 } 191 } 192 193 /*** 194 * Concrete version object updated everytime it's checked-in in a CVS 195 * repository. 196 */ 197 public static final Version VERSION = 198 VersionFactory.createVersion("$Revision: 1.4 $"); 199 200 /*** 201 * Retrieves the current version of this object. 202 * @return the version object with such information. 203 */ 204 public Version getVersion() 205 { 206 return VERSION; 207 } 208 209 /*** 210 * Retrieves the current version of this class. It's defined because 211 * this is a utility class that cannot be instantiated. 212 * @return the object with class version information. 213 */ 214 public static Version getClassVersion() 215 { 216 return VERSION; 217 } 218 }

This page was automatically generated by Maven