Update of /cvsroot/webmacro/webmacro/test/unit/org/webmacro In directory sc8-pr-cvs1:/tmp/cvs-serv6675/test/unit/org/webmacro Modified Files: FooDirective.java TestBroker.java TestContext.java TestFastWriter.java TestMultipleInstances.java TestStaticIdentityCM.java TestVersion.java Log Message: If this doesn't drive our SF "activity" stats through the roof, I don't know what will. Mass re-formatting of all code, following (to the best of my interpertation) the Sun (w/ jakarta tweaks) coding style guidelines defined here: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html and here: http://jakarta.apache.org/turbine/common/code-standards.html I did this reformatting with IDEA 3.0.5, and I am going to commit the style configuration for IDEA (if I can find it). Index: FooDirective.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/FooDirective.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FooDirective.java 5 Jan 2002 22:19:33 -0000 1.3 --- FooDirective.java 12 Jun 2003 00:47:49 -0000 1.4 *************** *** 23,62 **** package org.webmacro; - import java.io.*; - import org.webmacro.*; import org.webmacro.directive.Directive; - import org.webmacro.directive.DirectiveDescriptor; import org.webmacro.directive.DirectiveBuilder; ! import org.webmacro.engine.*; ! public class FooDirective extends Directive { ! private static final ArgDescriptor[] ! myArgs = new ArgDescriptor[] { ! }; ! private static final DirectiveDescriptor ! myDescr = new DirectiveDescriptor("foo", null, myArgs, null); ! public static DirectiveDescriptor getDescriptor() { ! return myDescr; ! } - public Object build(DirectiveBuilder builder, - BuildContext bc) - throws BuildException { - return this; - } ! public void write(FastWriter out, Context context) ! throws PropertyException, IOException { ! out.write ("foo"); ! } ! public void accept(TemplateVisitor v) { ! v.beginDirective(myDescr.name); ! v.endDirective(); ! } } --- 23,72 ---- package org.webmacro; import org.webmacro.directive.Directive; import org.webmacro.directive.DirectiveBuilder; ! import org.webmacro.directive.DirectiveDescriptor; ! import org.webmacro.engine.BuildContext; ! import org.webmacro.engine.BuildException; ! import java.io.IOException; ! public class FooDirective extends Directive ! { ! private static final ArgDescriptor[] ! myArgs = new ArgDescriptor[]{ ! }; ! private static final DirectiveDescriptor ! myDescr = new DirectiveDescriptor("foo", null, myArgs, null); ! public static DirectiveDescriptor getDescriptor () ! { ! return myDescr; ! } ! ! public Object build (DirectiveBuilder builder, ! BuildContext bc) ! throws BuildException ! { ! return this; ! } ! ! ! public void write (FastWriter out, Context context) ! throws PropertyException, IOException ! { ! out.write("foo"); ! } ! ! ! public void accept (TemplateVisitor v) ! { ! v.beginDirective(myDescr.name); ! v.endDirective(); ! } } Index: TestBroker.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestBroker.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TestBroker.java 23 Mar 2003 02:00:34 -0000 1.3 --- TestBroker.java 12 Jun 2003 00:47:49 -0000 1.4 *************** *** 1,62 **** package org.webmacro; ! import java.io.*; ! import org.webmacro.*; ! import org.webmacro.util.*; ! import junit.framework.*; - /* Test various features of a default-configured Broker */ - public class TestBroker extends TestCase { - private WebMacro _wm; - private Broker _broker; ! public TestBroker(String name) { ! super(name); ! } - protected void setUp() { - try { - if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) - System.getProperties().setProperty("org.webmacro.LogLevel", "ERROR"); - _wm = new WM (); - } catch (Exception e) { - System.err.println ("Could not initialize WebMacro!"); - } - _broker = _wm.getBroker (); - } - - public void testBrokerLocal () throws Exception { - _broker.setBrokerLocal ("MyName", "Mud"); ! assertTrue (_broker.getBrokerLocal ("MyName") ! .toString().equals ("Mud")); ! } - public void testGetSettings() throws Exception { - Settings s = _broker.getSettings(); - assertTrue (s != null); - assertTrue (_broker.getSetting("ErrorTemplate") - .equals ("error.wm")); - } ! public void testGetProvider() throws Exception { ! Provider p = _broker.getProvider ("template"); ! assertTrue (p != null); ! } ! public void testGetLog() throws Exception { ! Log l = _broker.getLog ("template"); ! assertTrue (l != null); - l = _broker.getLog ("NewLog"); - assertTrue (l != null); - } ! public void testGetResource() throws Exception { ! java.net.URL url = _broker.getResource ("WebMacro.defaults"); ! assertTrue (url != null); ! } } --- 1,77 ---- package org.webmacro; ! import junit.framework.TestCase; ! import org.webmacro.util.Settings; ! /* Test various features of a default-configured Broker */ ! public class TestBroker extends TestCase ! { ! private WebMacro _wm; ! private Broker _broker; ! public TestBroker (String name) ! { ! super(name); ! } ! protected void setUp () ! { ! try ! { ! if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) ! System.getProperties().setProperty("org.webmacro.LogLevel", "ERROR"); ! _wm = new WM(); ! } ! catch (Exception e) ! { ! System.err.println("Could not initialize WebMacro!"); ! } ! _broker = _wm.getBroker(); ! } ! public void testBrokerLocal () throws Exception ! { ! _broker.setBrokerLocal("MyName", "Mud"); ! assertTrue(_broker.getBrokerLocal("MyName") ! .toString().equals("Mud")); ! } ! public void testGetSettings () throws Exception ! { ! Settings s = _broker.getSettings(); ! assertTrue(s != null); ! assertTrue(_broker.getSetting("ErrorTemplate") ! .equals("error.wm")); ! } ! ! ! public void testGetProvider () throws Exception ! { ! Provider p = _broker.getProvider("template"); ! assertTrue(p != null); ! } ! ! ! public void testGetLog () throws Exception ! { ! Log l = _broker.getLog("template"); ! assertTrue(l != null); ! ! l = _broker.getLog("NewLog"); ! assertTrue(l != null); ! } ! ! ! public void testGetResource () throws Exception ! { ! java.net.URL url = _broker.getResource("WebMacro.defaults"); ! assertTrue(url != null); ! } } Index: TestContext.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestContext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestContext.java 23 Mar 2003 02:00:34 -0000 1.2 --- TestContext.java 12 Jun 2003 00:47:49 -0000 1.3 *************** *** 1,21 **** package org.webmacro; - import java.io.*; - - import org.webmacro.engine.StringTemplate; import org.webmacro.engine.DefaultEvaluationExceptionHandler; import org.webmacro.template.TemplateTestCase; ! import junit.framework.*; ! ! import org.apache.regexp.RE; ! ! public class TestContext extends TemplateTestCase { ! public TestContext(String name) { super(name); } ! public void stuffContext(Context context) throws Exception { context.setEvaluationExceptionHandler( new DefaultEvaluationExceptionHandler()); --- 1,18 ---- package org.webmacro; import org.webmacro.engine.DefaultEvaluationExceptionHandler; import org.webmacro.template.TemplateTestCase; ! public class TestContext extends TemplateTestCase ! { ! public TestContext (String name) ! { super(name); } ! ! public void stuffContext (Context context) throws Exception ! { context.setEvaluationExceptionHandler( new DefaultEvaluationExceptionHandler()); *************** *** 23,88 **** ! ! ! public void testPutGet_NULL() throws Exception { ! _context.put ("Foo", null); Object o = _context.get("Foo"); ! assertTrue (_context.get("Foo") == null); } - public void testPutGet_int() throws Exception { - _context.put ("Foo", 123); - Integer i = (Integer) _context.get ("Foo"); - assertTrue (i.intValue() == 123); - } ! public void testPutGet_boolean() throws Exception { ! _context.put ("Foo", true); ! Boolean b = (Boolean) _context.get ("Foo"); ! assertTrue (b.booleanValue() == true); } ! public void testPutGet_byte() throws Exception { ! _context.put ("Foo", (byte)123); ! Byte b = (Byte) _context.get ("Foo"); ! assertTrue (b.byteValue() == (byte) 123); } - public void testPutGet_char() throws Exception { - _context.put ("Foo", (char)123); - Character c = (Character) _context.get ("Foo"); - assertTrue (c.charValue() == (char)123); - } ! public void testPutGet_Class() throws Exception { ! _context.put ("Foo", this.getClass()); ! Object o = _context.get ("Foo"); ! assertTrue (o instanceof org.webmacro.engine.StaticClassWrapper); } - public void testPutGet_double() throws Exception { - _context.put ("Foo", 123.4D); - Double d= (Double) _context.get ("Foo"); - assertTrue (d.doubleValue() == 123.4D); - } ! public void testPutGet_long() throws Exception { ! _context.put ("Foo", 123L); ! Long l = (Long) _context.get ("Foo"); ! assertTrue (l.longValue() == 123L); } ! public void testPutGet_short() throws Exception { ! _context.put ("Foo", (short) 123); ! Short s = (Short) _context.get ("Foo"); ! assertTrue (s.shortValue() == (short) 123); } --- 20,93 ---- ! public void testPutGet_NULL () throws Exception ! { ! _context.put("Foo", null); Object o = _context.get("Foo"); ! assertTrue(_context.get("Foo") == null); } ! public void testPutGet_int () throws Exception ! { ! _context.put("Foo", 123); ! Integer i = (Integer) _context.get("Foo"); ! assertTrue(i.intValue() == 123); } ! public void testPutGet_boolean () throws Exception ! { ! _context.put("Foo", true); ! Boolean b = (Boolean) _context.get("Foo"); ! assertTrue(b.booleanValue() == true); } ! public void testPutGet_byte () throws Exception ! { ! _context.put("Foo", (byte) 123); ! Byte b = (Byte) _context.get("Foo"); ! assertTrue(b.byteValue() == (byte) 123); } ! public void testPutGet_char () throws Exception ! { ! _context.put("Foo", (char) 123); ! Character c = (Character) _context.get("Foo"); ! assertTrue(c.charValue() == (char) 123); } ! ! public void testPutGet_Class () throws Exception ! { ! _context.put("Foo", this.getClass()); ! Object o = _context.get("Foo"); ! assertTrue(o instanceof org.webmacro.engine.StaticClassWrapper); } + public void testPutGet_double () throws Exception + { + _context.put("Foo", 123.4D); + Double d = (Double) _context.get("Foo"); + assertTrue(d.doubleValue() == 123.4D); + } + public void testPutGet_long () throws Exception + { + _context.put("Foo", 123L); + Long l = (Long) _context.get("Foo"); + assertTrue(l.longValue() == 123L); + } + public void testPutGet_short () throws Exception + { + _context.put("Foo", (short) 123); + Short s = (Short) _context.get("Foo"); + assertTrue(s.shortValue() == (short) 123); + } Index: TestFastWriter.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestFastWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestFastWriter.java 23 Mar 2003 02:00:35 -0000 1.2 --- TestFastWriter.java 12 Jun 2003 00:47:49 -0000 1.3 *************** *** 11,22 **** import junit.framework.TestCase; ! public class TestFastWriter extends TestCase { private WebMacro wm; ! public TestFastWriter(String name) { super(name); } ! protected void setUp() throws Exception { java.lang.System.setProperty("org.webmacro.LogLevel", "NONE"); wm = new WM(); --- 11,28 ---- import junit.framework.TestCase; ! public class TestFastWriter extends TestCase ! { private WebMacro wm; ! ! ! public TestFastWriter (String name) ! { super(name); } ! ! protected void setUp () throws Exception ! { java.lang.System.setProperty("org.webmacro.LogLevel", "NONE"); wm = new WM(); *************** *** 24,35 **** ! public void testFastWriter() throws Exception { doIt(4 * 1024); doIt(10 * 1024); doIt(100 * 1024); ! doIt(1000* 1024); doIt(4000 * 1024); } ! private void doIt(int size) throws Exception { String data = makeData(size); --- 30,45 ---- ! public void testFastWriter () throws Exception ! { doIt(4 * 1024); doIt(10 * 1024); doIt(100 * 1024); ! doIt(1000 * 1024); doIt(4000 * 1024); } ! ! ! private void doIt (int size) throws Exception ! { String data = makeData(size); *************** *** 41,53 **** long end = System.currentTimeMillis(); ! System.err.println (size + " bytes in " + ((end-start)/1000D) + " seconds."); ! assertTrue (after.equals(data)); } ! private String makeData (int size) { StringBuffer sb = new StringBuffer(size); ! for (int x=0; x<size; x++) sb.append('x'); --- 51,64 ---- long end = System.currentTimeMillis(); ! System.err.println(size + " bytes in " + ((end - start) / 1000D) + " seconds."); ! assertTrue(after.equals(data)); } ! private String makeData (int size) ! { StringBuffer sb = new StringBuffer(size); ! for (int x = 0; x < size; x++) sb.append('x'); Index: TestMultipleInstances.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestMultipleInstances.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestMultipleInstances.java 27 Mar 2003 00:35:31 -0000 1.5 --- TestMultipleInstances.java 12 Jun 2003 00:47:49 -0000 1.6 *************** *** 1,35 **** package org.webmacro; - import java.util.*; - import junit.framework.TestCase; import org.webmacro.engine.StringTemplate; /** * Ensure that multiple instances of WM can co-exist in the same JVM. */ ! public class TestMultipleInstances extends TestCase { private WebMacro _instanceOne; private WebMacro _instanceTwo; ! public TestMultipleInstances(String name) { super(name); } ! protected void setUp() throws Exception { // we don't want to see any WebMacro output from this test if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) System.getProperties().setProperty("org.webmacro.LogLevel", "NONE"); ! try { _instanceOne = new WM(); ! } catch (Exception e) { System.err.println("Could not initialize Default WebMacro Instance"); throw e; } ! try { _instanceTwo = new WM("org/webmacro/TestMulti_1.properties"); ! } catch (Exception e) { System.err.println("Could not initialize another WebMacro Instance using org/webmacro/TestMulti_1.properties!"); throw e; --- 1,46 ---- package org.webmacro; import junit.framework.TestCase; import org.webmacro.engine.StringTemplate; + import java.util.Properties; + /** * Ensure that multiple instances of WM can co-exist in the same JVM. */ ! public class TestMultipleInstances extends TestCase ! { private WebMacro _instanceOne; private WebMacro _instanceTwo; ! ! public TestMultipleInstances (String name) ! { super(name); } ! ! protected void setUp () throws Exception ! { // we don't want to see any WebMacro output from this test if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) System.getProperties().setProperty("org.webmacro.LogLevel", "NONE"); ! try ! { _instanceOne = new WM(); ! } ! catch (Exception e) ! { System.err.println("Could not initialize Default WebMacro Instance"); throw e; } ! try ! { _instanceTwo = new WM("org/webmacro/TestMulti_1.properties"); ! } ! catch (Exception e) ! { System.err.println("Could not initialize another WebMacro Instance using org/webmacro/TestMulti_1.properties!"); throw e; *************** *** 37,41 **** } ! public void testFooDirective() throws Exception { String template = " #foo "; String output = null; --- 48,54 ---- } ! ! public void testFooDirective () throws Exception ! { String template = " #foo "; String output = null; *************** *** 44,58 **** // against the default configured WM isntance, this *should* throw // an exception ! System.err.println ("----------- instance 1 -----------------"); ! try { if (_instanceOne != null) executeStringTemplate(_instanceOne, _instanceOne.getContext(), template); ! } catch (Exception e) { assertTrue(e.toString().indexOf("No such directive #foo") > -1); } // against the other WM instance, this should return the string "foo" ! System.err.println (); ! System.err.println ("----------- instance 2 -----------------"); output = executeStringTemplate(_instanceTwo, _instanceTwo.getContext(), template); assertTrue(output.equals("foo")); --- 57,74 ---- // against the default configured WM isntance, this *should* throw // an exception ! System.err.println("----------- instance 1 -----------------"); ! try ! { if (_instanceOne != null) executeStringTemplate(_instanceOne, _instanceOne.getContext(), template); ! } ! catch (Exception e) ! { assertTrue(e.toString().indexOf("No such directive #foo") > -1); } // against the other WM instance, this should return the string "foo" ! System.err.println(); ! System.err.println("----------- instance 2 -----------------"); output = executeStringTemplate(_instanceTwo, _instanceTwo.getContext(), template); assertTrue(output.equals("foo")); *************** *** 60,64 **** ! public void testDefaultConstructor() throws InitException { WM wm1 = new WM(); WM wm2 = new WM(); --- 76,81 ---- ! public void testDefaultConstructor () throws InitException ! { WM wm1 = new WM(); WM wm2 = new WM(); *************** *** 92,98 **** } /** Execute a string as a template against the current context, * and return the result. */ ! public String executeStringTemplate(WebMacro wm, Context context, String templateText) throws Exception { Broker b = wm.getBroker(); Template template = new StringTemplate(b, templateText); --- 109,117 ---- } + /** Execute a string as a template against the current context, * and return the result. */ ! public String executeStringTemplate (WebMacro wm, Context context, String templateText) throws Exception ! { Broker b = wm.getBroker(); Template template = new StringTemplate(b, templateText); Index: TestStaticIdentityCM.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestStaticIdentityCM.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestStaticIdentityCM.java 23 Mar 2003 02:00:36 -0000 1.2 --- TestStaticIdentityCM.java 12 Jun 2003 00:47:49 -0000 1.3 *************** *** 1,7 **** package org.webmacro; ! import org.webmacro.resource.*; ! ! import junit.framework.*; import java.util.Random; --- 1,7 ---- package org.webmacro; ! import junit.framework.TestCase; ! import org.webmacro.resource.CacheManager; ! import org.webmacro.resource.StaticIdentityCacheManager; import java.util.Random; *************** *** 12,16 **** * @author Sebastian Kanthak */ ! public class TestStaticIdentityCM extends TestCase { public static final int THREADS = 10; public static final int LOOPS = 10000; --- 12,17 ---- * @author Sebastian Kanthak */ ! public class TestStaticIdentityCM extends TestCase ! { public static final int THREADS = 10; public static final int LOOPS = 10000; *************** *** 19,75 **** private WebMacro wm; private CacheManager cm; ! ! public TestStaticIdentityCM(String name) { super(name); } ! protected void setUp() throws InitException { if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) System.getProperties().setProperty("org.webmacro.LogLevel", "ERROR"); wm = new WM(); cm = new StaticIdentityCacheManager(); ! cm.init(wm.getBroker(),wm.getBroker().getSettings(),"foo"); } /** * Tests integrity of cache under high load */ ! public void testCacheIntegrity() throws InterruptedException { TestThread[] threads = new TestThread[THREADS]; ! for (int i=0; i < THREADS; i++) { ! threads[i] = new TestThread(cm,i); } ! for (int i=0; i < THREADS; i++) { threads[i].start(); } ! for (int i=0; i < THREADS; i++) { threads[i].join(); } ! for (int i=0; i < THREADS; i++) { ! assertTrue("Test integrity check failed in thread "+i, ! threads[i].correct); } } /** * Assures, that cm uses "==" to test * for equality */ ! public void testCacheIdentityBehaviour() { String key1 = new String("foo"); String key2 = new String("foo"); assertTrue("test preconditions not met: keys should be different", ! key1 != key2 && key1.equals(key2)); Object cached1 = new Object(); Object cached2 = new Object(); ! cm.put(key1,cached1); ! cm.put(key2,cached2); assertTrue("cm returned wrong object", ! cm.get(key1) == cached1); assertTrue("cm returned wrong object", ! cm.get(key2) == cached2); } ! static class TestThread extends Thread { private CacheManager cm; private int id; --- 20,90 ---- private WebMacro wm; private CacheManager cm; ! ! ! public TestStaticIdentityCM (String name) ! { super(name); } ! ! protected void setUp () throws InitException ! { if (System.getProperties().getProperty("org.webmacro.LogLevel") == null) System.getProperties().setProperty("org.webmacro.LogLevel", "ERROR"); wm = new WM(); cm = new StaticIdentityCacheManager(); ! cm.init(wm.getBroker(), wm.getBroker().getSettings(), "foo"); } + /** * Tests integrity of cache under high load */ ! public void testCacheIntegrity () throws InterruptedException ! { TestThread[] threads = new TestThread[THREADS]; ! for (int i = 0; i < THREADS; i++) ! { ! threads[i] = new TestThread(cm, i); } ! for (int i = 0; i < THREADS; i++) ! { threads[i].start(); } ! for (int i = 0; i < THREADS; i++) ! { threads[i].join(); } ! for (int i = 0; i < THREADS; i++) ! { ! assertTrue("Test integrity check failed in thread " + i, ! threads[i].correct); } } + /** * Assures, that cm uses "==" to test * for equality */ ! public void testCacheIdentityBehaviour () ! { String key1 = new String("foo"); String key2 = new String("foo"); assertTrue("test preconditions not met: keys should be different", ! key1 != key2 && key1.equals(key2)); Object cached1 = new Object(); Object cached2 = new Object(); ! cm.put(key1, cached1); ! cm.put(key2, cached2); assertTrue("cm returned wrong object", ! cm.get(key1) == cached1); assertTrue("cm returned wrong object", ! cm.get(key2) == cached2); } ! ! static class TestThread extends Thread ! { private CacheManager cm; private int id; *************** *** 77,84 **** private Object[] sources = new Object[10]; private Object[] cached = new Object[10]; ! boolean correct = true; // until proved otherwise ! ! public TestThread(CacheManager cm,int id) { super(); this.cm = cm; --- 92,101 ---- private Object[] sources = new Object[10]; private Object[] cached = new Object[10]; ! boolean correct = true; // until proved otherwise ! ! ! public TestThread (CacheManager cm, int id) ! { super(); this.cm = cm; *************** *** 86,104 **** } ! public void run() { int count = 0; int loops = 0; ! for (int i=0; i < LOOPS; i++) { ! if (count++ == 0) fillCache(); ! if (count == 100) { count = 0; } int index = random.nextInt(sources.length); ! try { Object test = cm.get(sources[index]); if (test != cached[index]) correct = false; ! } catch (Exception e) { correct = false; } --- 103,128 ---- } ! ! public void run () ! { int count = 0; int loops = 0; ! for (int i = 0; i < LOOPS; i++) ! { ! if (count++ == 0) fillCache(); ! if (count == 100) ! { count = 0; } int index = random.nextInt(sources.length); ! try ! { Object test = cm.get(sources[index]); if (test != cached[index]) correct = false; ! } ! catch (Exception e) ! { correct = false; } *************** *** 106,114 **** } ! private void fillCache() { ! for (int i=0; i < sources.length; i++) { sources[i] = new byte[1000]; // dummy cache key cached[i] = new Object(); // dummy cache load ! cm.put(sources[i],cached[i]); } } --- 130,141 ---- } ! ! private void fillCache () ! { ! for (int i = 0; i < sources.length; i++) ! { sources[i] = new byte[1000]; // dummy cache key cached[i] = new Object(); // dummy cache load ! cm.put(sources[i], cached[i]); } } Index: TestVersion.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/test/unit/org/webmacro/TestVersion.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TestVersion.java 23 Mar 2003 02:00:36 -0000 1.4 --- TestVersion.java 12 Jun 2003 00:47:49 -0000 1.5 *************** *** 1,33 **** package org.webmacro; ! import java.io.*; ! import org.webmacro.*; ! import org.webmacro.util.*; ! import junit.framework.*; ! /* Make sure our ANT filter to set the Version of WebMacro actually worked. */ ! public class TestVersion extends TestCase { - public TestVersion(String name) { - super(name); - } ! protected void setUp() { ! // no need to do any setup work ! } - - /** - * ensure the build-time version has been inserted into WebMacro.java - * by making sure the version does NOT equal the tag @VERSION@ - */ - public void testVersion () throws Exception { - assertTrue (!WebMacro.VERSION.equals("@VERSION@")); - } ! public void testBuildDate() throws Exception { ! assertTrue (!WebMacro.BUILD_DATE.equals("@BUILD_DATE@")); ! } } --- 1,36 ---- package org.webmacro; ! import junit.framework.TestCase; ! /* Make sure our ANT filter to set the Version of WebMacro actually worked. */ ! public class TestVersion extends TestCase ! { ! public TestVersion (String name) ! { ! super(name); ! } ! protected void setUp () ! { ! // no need to do any setup work ! } ! /** ! * ensure the build-time version has been inserted into WebMacro.java ! * by making sure the version does NOT equal the tag @VERSION@ ! */ ! public void testVersion () throws Exception ! { ! assertTrue(!WebMacro.VERSION.equals("@VERSION@")); ! } ! ! ! public void testBuildDate () throws Exception ! { ! assertTrue(!WebMacro.BUILD_DATE.equals("@BUILD_DATE@")); ! } } |