You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2011/12/06 03:48:13 UTC

svn commit: r1210754 - /cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java

Author: aadamchik
Date: Tue Dec  6 02:48:13 2011
New Revision: 1210754

URL: http://svn.apache.org/viewvc?rev=1210754&view=rev
Log:
CAY-1607 [PATCH] add pluralize method to StringUtils for use in templates

missed the unit test from the original commit

Added:
    cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java

Added: cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java?rev=1210754&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-tools/src/test/java/org/apache/cayenne/gen/StringUtilsTest.java Tue Dec  6 02:48:13 2011
@@ -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.cayenne.gen;
+
+import junit.framework.TestCase;
+
+public class StringUtilsTest extends TestCase {
+
+    protected StringUtils stringUtils;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        stringUtils = new StringUtils();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        stringUtils = null;
+    }
+
+    public void testPluralize() throws Exception {
+        assertEquals("Words", stringUtils.pluralize("Word"));
+        assertEquals("Statuses", stringUtils.pluralize("Status"));
+        assertEquals("Indexes", stringUtils.pluralize("Index"));
+        assertEquals("Factories", stringUtils.pluralize("Factory"));
+        assertEquals("", stringUtils.pluralize(""));
+        assertEquals(null, stringUtils.pluralize(null));
+    }
+
+}