Return-Path: Delivered-To: apmail-velocity-commits-archive@locus.apache.org Received: (qmail 50927 invoked from network); 15 Feb 2007 01:24:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2007 01:24:52 -0000 Received: (qmail 58163 invoked by uid 500); 15 Feb 2007 01:25:00 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 58134 invoked by uid 500); 15 Feb 2007 01:25:00 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 58125 invoked by uid 99); 15 Feb 2007 01:25:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Feb 2007 17:25:00 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Feb 2007 17:24:52 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id DCA3D1A981A; Wed, 14 Feb 2007 17:24:31 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r507769 - /velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java Date: Thu, 15 Feb 2007 01:24:31 -0000 To: commits@velocity.apache.org From: nbubna@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070215012431.DCA3D1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nbubna Date: Wed Feb 14 17:24:31 2007 New Revision: 507769 URL: http://svn.apache.org/viewvc?view=rev&rev=507769 Log: add assertStringEquals() so we needn't always call toString() on results Modified: velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java Modified: velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java URL: http://svn.apache.org/viewvc/velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java?view=diff&rev=507769&r1=507768&r2=507769 ============================================================================== --- velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java (original) +++ velocity/tools/trunk/src/test/org/apache/velocity/tools/test/whitebox/GenericToolsTests.java Wed Feb 14 17:24:31 2007 @@ -63,20 +63,24 @@ assertNotNull(alternatorTool); /* test automatic alternator */ Alternator auto = alternatorTool.auto(new String[] {"red","blue","yellow"}); - assertEquals("red",auto.getCurrent()); - assertEquals("red",auto.getNext()); - assertEquals("blue",auto.toString()); - assertEquals("yellow",auto.toString()); - assertEquals("red",auto.toString()); + assertStringEquals("red", auto.getCurrent()); + assertStringEquals("red", auto.getNext()); + assertStringEquals("blue", auto); + assertStringEquals("yellow", auto); + assertStringEquals("red", auto); /* test manual alternator (use 'make()' and not 'manual()' since we define the default to be manual in toolbox.xml*/ Alternator manual = alternatorTool.make(new String[] {"red","blue","yellow"}); - assertEquals("red",manual.toString()); - assertEquals("red",manual.toString()); + assertStringEquals("red", manual); + assertStringEquals("red", manual); manual.shift(); - assertEquals("blue",manual.toString()); + assertStringEquals("blue", manual); manual.shift(); manual.shift(); - assertEquals("red",manual.toString()); + assertStringEquals("red", manual); + } + + protected void assertStringEquals(String expected, Object testThis) { + assertEquals(expected, String.valueOf(testThis)); } public @Test void testDateTool() { /* TODO still incomplete */ @@ -148,26 +152,26 @@ assertNotNull(textTool); ResourceTool.Key foo = textTool.get("foo"); - assertEquals("bar", foo.toString()); + assertStringEquals("bar", foo); ResourceTool.Key frenchFoo = foo.locale(Locale.FRENCH); - assertEquals("barre", frenchFoo.toString()); + assertStringEquals("barre", frenchFoo); ResourceTool.Key otherFoo = foo.bundle("resources2"); - assertEquals("woogie", otherFoo.toString()); + assertStringEquals("woogie", otherFoo); ResourceTool.Key helloWhoever = textTool.get("hello").get("whoever"); - assertEquals("Hello {0}!", helloWhoever.toString()); + assertStringEquals("Hello {0}!", helloWhoever); ResourceTool.Key helloWorld = helloWhoever.insert(textTool.get("world")); - assertEquals("Hello World!", helloWorld.toString()); + assertStringEquals("Hello World!", helloWorld); ResourceTool.Key halfFrenchHelloWorld = helloWorld.locale(Locale.FRENCH); - assertEquals("Bonjour World!", halfFrenchHelloWorld.toString()); + assertStringEquals("Bonjour World!", halfFrenchHelloWorld); ResourceTool.Key frenchTool = textTool.locale(Locale.FRENCH); ResourceTool.Key frenchHelloWorld = frenchTool.get("hello.whoever").insert(frenchTool.get("world")); - assertEquals("Bonjour Monde!", frenchHelloWorld.toString()); + assertStringEquals("Bonjour Monde!", frenchHelloWorld); } }