Return-Path: Delivered-To: apmail-incubator-click-commits-archive@locus.apache.org Received: (qmail 57083 invoked from network); 7 Jan 2009 07:40:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2009 07:40:50 -0000 Received: (qmail 19526 invoked by uid 500); 7 Jan 2009 07:40:50 -0000 Delivered-To: apmail-incubator-click-commits-archive@incubator.apache.org Received: (qmail 19511 invoked by uid 500); 7 Jan 2009 07:40:50 -0000 Mailing-List: contact click-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: click-dev@incubator.apache.org Delivered-To: mailing list click-commits@incubator.apache.org Received: (qmail 19500 invoked by uid 99); 7 Jan 2009 07:40:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Jan 2009 23:40:50 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jan 2009 07:40:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 914022388988; Tue, 6 Jan 2009 23:40:27 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r732251 - /incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java Date: Wed, 07 Jan 2009 07:40:27 -0000 To: click-commits@incubator.apache.org From: sabob@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090107074027.914022388988@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sabob Date: Tue Jan 6 23:40:27 2009 New Revision: 732251 URL: http://svn.apache.org/viewvc?rev=732251&view=rev Log: added test for Format Added: incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java Added: incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java?rev=732251&view=auto ============================================================================== --- incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java (added) +++ incubator/click/trunk/click/framework/test/org/apache/click/util/FormatTest.java Tue Jan 6 23:40:27 2009 @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.click.util; + +import java.util.Arrays; +import junit.framework.TestCase; +import org.apache.click.MockContext; + +/** + * Tests for ContainerUtils. + */ +public class FormatTest extends TestCase { + + public void testMessage() { + MockContext.initContext(); + + // Test message and single argument + String expected = "hello world"; + Format format = new Format(); + String actual = format.message("hello {0}", "world"); + assertEquals(expected, actual); + + // Test message and array of arguments + expected = "hello world array"; + actual = format.message("hello {0} {1}", new String[] {"world", "array"}); + assertEquals(expected, actual); + + // Test message and list of arguments + expected = "hello world list"; + actual = format.message("hello {0} {1}", Arrays.asList(new String[] {"world", "list"})); + assertEquals(expected, actual); + } +}