Author: aadamchik
Date: Fri Sep 1 14:48:29 2006
New Revision: 439489
URL: http://svn.apache.org/viewvc?rev=439489&view=rev
Log:
CAY-646
Added:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ClassGenerationInfoTst.java
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/gen/ClassGenerationInfo.java
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ImportUtilsTst.java
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/gen/ClassGenerationInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/gen/ClassGenerationInfo.java?rev=439489&r1=439488&r2=439489&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/gen/ClassGenerationInfo.java
(original)
+++
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/gen/ClassGenerationInfo.java
Fri Sep 1 14:48:29 2006
@@ -100,7 +100,7 @@
public String formatJavaType(String type) {
if (type != null) {
- if (type.startsWith("java.lang.") && type.indexOf(10, '.') < 0) {
+ if (type.startsWith("java.lang.") && type.indexOf('.', 10) < 0) {
return type.substring("java.lang.".length());
}
Added:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ClassGenerationInfoTst.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ClassGenerationInfoTst.java?rev=439489&view=auto
==============================================================================
---
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ClassGenerationInfoTst.java
(added)
+++
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ClassGenerationInfoTst.java
Fri Sep 1 14:48:29 2006
@@ -0,0 +1,32 @@
+/*****************************************************************
+ * 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 ClassGenerationInfoTst extends TestCase {
+
+ public void testFormatJavaType() {
+ ClassGenerationInfo info = new ClassGenerationInfo();
+
+ assertEquals("x.X", info.formatJavaType("x.X"));
+ assertEquals("X", info.formatJavaType("java.lang.X"));
+ assertEquals("java.lang.x.X", info.formatJavaType("java.lang.x.X"));
+ }
+}
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ImportUtilsTst.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ImportUtilsTst.java?rev=439489&r1=439488&r2=439489&view=diff
==============================================================================
---
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ImportUtilsTst.java
(original)
+++
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/test/java/org/apache/cayenne/gen/ImportUtilsTst.java
Fri Sep 1 14:48:29 2006
@@ -208,6 +208,12 @@
assertEquals(baseType, importUtils.formatJavaType(fullyQualifiedType));
}
+
+ public void testFormatJavaType() {
+ assertEquals("x.X", importUtils.formatJavaType("x.X"));
+ assertEquals("X", importUtils.formatJavaType("java.lang.X"));
+ assertEquals("java.lang.x.X",
importUtils.formatJavaType("java.lang.x.X"));
+ }
public void
testJavaLangTypeFormatJavaTypeWithoutAddTypeGeneratesCorrectFQNs()
throws Exception {