You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2011/11/27 21:46:19 UTC
svn commit: r1206841 - in /db/torque/torque4/trunk/torque-runtime/src:
main/java/org/apache/torque/om/ test/java/org/apache/torque/om/
Author: tfischer
Date: Sun Nov 27 20:46:17 2011
New Revision: 1206841
URL: http://svn.apache.org/viewvc?rev=1206841&view=rev
Log:
TORQUE-67: Clean up code in the om package:
- move equals method to the base class
- fix some NullPointerExceptions
- fix some javadocs
- return concrete types in SimpleKey.keyFor method
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/DateKey.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/SimpleKey.java
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/StringKey.java
db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/BooleanKey.java Sun Nov 27 20:46:17 2011
@@ -137,40 +137,12 @@ public class BooleanKey extends SimpleKe
}
/**
- * keyObj is equal to this StringKey if keyObj is a StringKey or String
- * that contains the same information this key contains. Two ObjectKeys
- * that both contain null values are not considered equal.
+ * Get a String representation of this key.
*
- * @param keyObj the comparison value
- * @return whether the two objects are equal
+ * @return a String representation of this key,
+ * or an empty String if the value is null.
*/
@Override
- public boolean equals(Object keyObj)
- {
- boolean isEqual = false;
-
- if (key != null)
- {
- if (keyObj instanceof Boolean)
- {
- isEqual = keyObj.equals(key);
- }
- // check against a BooleanKey. Two keys are equal, if their
- // internal keys equivalent.
- else if (keyObj instanceof BooleanKey)
- {
- Object obj = ((BooleanKey) keyObj).getValue();
- isEqual = key.equals(obj);
- }
- }
- return isEqual;
- }
-
- /**
- * get a String representation
- *
- * @return a String representation of an empty String if the value is null
- */
public String toString()
{
if (key != null)
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/DateKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/DateKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/DateKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/DateKey.java Sun Nov 27 20:46:17 2011
@@ -53,7 +53,14 @@ public class DateKey extends SimpleKey
*/
public DateKey(String key)
{
- this.key = new Date(Long.parseLong(key));
+ if (key != null)
+ {
+ this.key = new Date(Long.parseLong(key));
+ }
+ else
+ {
+ this.key = null;
+ }
}
/**
@@ -90,7 +97,14 @@ public class DateKey extends SimpleKey
*/
public void setValue(String key)
{
- this.key = new Date(Long.parseLong(key));
+ if (key != null)
+ {
+ this.key = new Date(Long.parseLong(key));
+ }
+ else
+ {
+ this.key = null;
+ }
}
/**
@@ -132,41 +146,12 @@ public class DateKey extends SimpleKey
}
/**
- * keyObj is equal to this DateKey if keyObj is a DateKey or String
- * that contains the same information this key contains. Two ObjectKeys
- * that both contain null values are not considered equal.
- *
- * @param keyObj the comparison value
- * @return whether the two objects are equal
- */
- @Override
- public boolean equals(Object keyObj)
- {
- boolean isEqual = false;
-
- if (key != null)
- {
- if (keyObj instanceof String)
- {
- isEqual = toString().equals(keyObj);
- }
- // check against a DateKey. Two keys are equal, if their
- // internal keys equivalent.
- else if (keyObj instanceof DateKey)
- {
- Object obj = ((DateKey) keyObj).getValue();
- isEqual = key.equals(obj);
- }
- }
- return isEqual;
- }
-
- /**
- * get a String representation
+ * Get a String representation for this key.
*
* @return a String representation of the Date or an empty String if the
* Date is null
*/
+ @Override
public String toString()
{
Date dt = getDate();
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/NumberKey.java Sun Nov 27 20:46:17 2011
@@ -54,7 +54,14 @@ public class NumberKey extends SimpleKey
*/
public NumberKey(String key)
{
- this.key = new BigDecimal(key);
+ if (key != null)
+ {
+ this.key = new BigDecimal(key);
+ }
+ else
+ {
+ this.key = null;
+ }
}
/**
@@ -135,20 +142,27 @@ public class NumberKey extends SimpleKey
/**
* Sets the internal representation using a String representation
- * of a number
+ * of a number.
*
* @param key the key value
* @throws NumberFormatException if key is not a valid number
*/
public void setValue(String key)
{
- this.key = new BigDecimal(key);
+ if (key != null)
+ {
+ this.key = new BigDecimal(key);
+ }
+ else
+ {
+ this.key = null;
+ }
}
/**
- * Sets the underlying object
+ * Sets the underlying object.
*
- * @param key the key value
+ * @param key the key value.
*/
public void setValue(BigDecimal key)
{
@@ -187,45 +201,6 @@ public class NumberKey extends SimpleKey
}
/**
- * Two ObjectKeys that both contain null values <strong>are not</strong>
- * considered equal.
- *
- * @param keyObj the key to compare values to
- * @return whether the two objects are equal
- */
- public boolean equals(Object keyObj)
- {
- if (keyObj == this)
- {
- return true;
- }
-
- if (!(keyObj instanceof NumberKey))
- {
- // NumberKeys used to be comparable to Strings. This behavior has
- // been changed, I don't think it is a good idea to fail silently
- // as code may be dependent on the old behavior.
- if (keyObj instanceof String)
- {
- throw new IllegalArgumentException(
- "NumberKeys are not comparable to Strings");
- }
-
- return false;
- }
-
- if (getValue() != null)
- {
- return getValue().equals(((NumberKey) keyObj).getValue());
- }
- else
- {
- // Even if they are both null...still return false.
- return false;
- }
- }
-
- /**
* @return a hash code based on the value
*/
public int hashCode()
@@ -250,11 +225,12 @@ public class NumberKey extends SimpleKey
}
/**
- * Invokes the toString() method on the object. An empty string
- * is returned is the value is null.
+ * Get a String representation of this key.
*
- * @return a String representation of the key value
+ * @return a String representation of this key,
+ * or an empty String if the value is null.
*/
+ @Override
public String toString()
{
if (key != null)
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/ObjectKey.java Sun Nov 27 20:46:17 2011
@@ -20,6 +20,7 @@ package org.apache.torque.om;
*/
import java.io.Serializable;
+
import org.apache.torque.TorqueException;
/**
@@ -35,6 +36,7 @@ public abstract class ObjectKey implemen
{
/** Version id for serializing. */
private static final long serialVersionUID = 1L;
+
/**
* The underlying key value.
*/
@@ -50,7 +52,7 @@ public abstract class ObjectKey implemen
/**
* Returns the hashcode of the underlying value (key), if key is
- * not null. Otherwise calls Object.hashCode()
+ * not null. Otherwise calls Object.hashCode()
*
* @return an <code>int</code> value
*/
@@ -64,6 +66,41 @@ public abstract class ObjectKey implemen
}
/**
+ * Returns whether this ObjekctKey is equal to another Object.
+ * obj is equal to this ObjectKey if obj has the same class
+ * as this ObjectKey and contains the same information
+ * this key contains.
+ * Two ObjectKeys that both contain null values are not considered equal.
+ *
+ * @param obj the comparison value.
+ *
+ * @return whether the two objects are equal.
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (obj.getClass() != this.getClass())
+ {
+ return false;
+ }
+
+ ObjectKey objectKey = (ObjectKey) obj;
+ if (key == null)
+ {
+ return false;
+ }
+ return key.equals(objectKey.getValue());
+ }
+
+ /**
* Get the underlying object.
*
* @return the underlying object
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/SimpleKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/SimpleKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/SimpleKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/SimpleKey.java Sun Nov 27 20:46:17 2011
@@ -20,7 +20,7 @@ package org.apache.torque.om;
*/
/**
- * This empty class marks an ObjectKey as being capable of being
+ * This empty class marks an ObjectKey as being capable of being
* represented as a single column in a database.
*
* @author <a href="mailto:jmcnally@apache.org">John McNally</a>
@@ -33,111 +33,133 @@ public abstract class SimpleKey extends
private static final long serialVersionUID = 1L;
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(java.math.BigDecimal key)
+ public static NumberKey keyFor(java.math.BigDecimal key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(int key)
+ public static NumberKey keyFor(int key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(long key)
+ public static NumberKey keyFor(long key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(double key)
+ public static NumberKey keyFor(double key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(Number key)
+ public static NumberKey keyFor(Number key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(NumberKey key)
+ public static NumberKey keyFor(NumberKey key)
{
return new NumberKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(String key)
+ public static StringKey keyFor(String key)
{
return new StringKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(StringKey key)
+ public static StringKey keyFor(StringKey key)
{
return new StringKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(java.util.Date key)
+ public static DateKey keyFor(java.util.Date key)
{
return new DateKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(DateKey key)
+ public static DateKey keyFor(DateKey key)
{
return new DateKey(key);
}
/**
- * Creates a SimpleKey equivalent to key
- * @param key the key value
- * @return a SimpleKey
+ * Creates an ObjectKey for the key object.
+ *
+ * @param key the key value.
+ *
+ * @return an ObjectKey for <code>key</code>.
*/
- public static SimpleKey keyFor(Boolean key)
+ public static BooleanKey keyFor(Boolean key)
{
return new BooleanKey(key);
}
Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/StringKey.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/StringKey.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/StringKey.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/om/StringKey.java Sun Nov 27 20:46:17 2011
@@ -120,40 +120,12 @@ public class StringKey extends SimpleKey
}
/**
- * keyObj is equal to this StringKey if keyObj is a StringKey or String
- * that contains the same information this key contains. Two ObjectKeys
- * that both contain null values are not considered equal.
+ * Get a String representation of this key.
*
- * @param keyObj the comparison value
- * @return whether the two objects are equal
+ * @return a String representation of this key,
+ * or an empty String if the value is null.
*/
@Override
- public boolean equals(Object keyObj)
- {
- boolean isEqual = false;
-
- if (key != null)
- {
- if (keyObj instanceof String)
- {
- isEqual = keyObj.equals(key);
- }
- // check against a StringKey. Two keys are equal, if their
- // internal keys equivalent.
- else if (keyObj instanceof StringKey)
- {
- Object obj = ((StringKey) keyObj).getValue();
- isEqual = key.equals(obj);
- }
- }
- return isEqual;
- }
-
- /**
- * get a String representation
- *
- * @return a String representation of an empty String if the value is null
- */
public String toString()
{
if (key != null)
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java?rev=1206841&r1=1206840&r2=1206841&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/om/NumberKeyTest.java Sun Nov 27 20:46:17 2011
@@ -19,13 +19,13 @@ package org.apache.torque.om;
* under the License.
*/
+import java.math.BigDecimal;
import java.util.Arrays;
-import junit.framework.Assert;
import junit.framework.TestCase;
/**
- * Currently just tests the equality of NumberKey.
+ * Tests the NumberKey class.
*
* @author <a href="mailto:stephenh@chase3000.com">Stephen Haberman</a>
* @version $Id$
@@ -43,64 +43,60 @@ public class NumberKeyTest extends TestC
private NumberKey n2a = new NumberKey(2);
/**
- * Simple constructor.
- *
- * @param name the name of the test to execute
+ * Test a.equals(a)
*/
- public NumberKeyTest(String name)
+ public void testEqualsReflexive()
{
- super(name);
+ assertTrue(n1a.equals(n1a));
}
/**
- * Test a.equals(a)
+ * Test a.hashCode().equals(a.hashCode())
*/
- public void testReflexive()
+ public void testHashCodeEqual()
{
- Assert.assertTrue(n1a.equals(n1a));
+ assertEquals(n1a.hashCode(), n1b.hashCode());
+ }
+
+ /**
+ * Test !a.equals(b)
+ */
+ public void testEqualsFalse()
+ {
+ assertFalse(n1a.equals(n2a));
+ assertTrue(n1a.hashCode() == n1a.hashCode());
}
/**
* Test a.equals(b) = b.equals(a)
*/
- public void testSymmetric()
+ public void testEqualsSymmetric()
{
- Assert.assertTrue(n1a.equals(n1b));
- Assert.assertTrue(n1b.equals(n1a));
+ assertTrue(n1a.equals(n1b));
+ assertTrue(n1b.equals(n1a));
- Assert.assertTrue(!"1".equals(n1a));
- // As this used to give false, i.e. n1a was considered equal to "1"
- // it can lead to difficult to find bugs if it is immediately
- // changed to the opposite. So this will throw an exception.
- //Assert.assertTrue(!n1a.equals("1"));
- try
- {
- Assert.assertTrue(!n1a.equals("1"));
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
- Assert.assertTrue(!n1a.equals(new Integer(1)));
- Assert.assertTrue(!new Integer(1).equals(n1a));
+ assertFalse("1".equals(n1a));
+ assertFalse(n1a.equals("1"));
+ assertFalse(n1a.equals(new Integer(1)));
+ assertFalse(new Integer(1).equals(n1a));
}
/**
* Test a.equals(b) = b.equals(c) = c.equals(a)
*/
- public void testTransitive()
+ public void testEqualsTransitive()
{
- Assert.assertTrue(n1a.equals(n1b));
- Assert.assertTrue(n1b.equals(n1c));
- Assert.assertTrue(n1c.equals(n1a));
+ assertTrue(n1a.equals(n1b));
+ assertTrue(n1b.equals(n1c));
+ assertTrue(n1c.equals(n1a));
}
/**
* Test !a.equals(null)
*/
- public void testNull()
+ public void testEqualsNull()
{
- Assert.assertTrue(!n1a.equals(null));
+ assertFalse(n1a.equals(null));
}
/**
@@ -108,20 +104,160 @@ public class NumberKeyTest extends TestC
*/
public void testList()
{
- Object[] array = new Object[] { n1a, n2a, n1b };
+ Object[] array = new Object[] {n1a, n2a, n1b};
Arrays.sort(array);
- Assert.assertEquals(n1a, array[0]);
- Assert.assertEquals(n1b, array[1]);
- Assert.assertEquals(n2a, array[2]);
+ assertEquals(n1a, array[0]);
+ assertEquals(n1b, array[1]);
+ assertEquals(n2a, array[2]);
+ }
+
+ /**
+ * Test copy constructor.
+ */
+ public void testEmptyConstructor()
+ {
+ NumberKey key = new NumberKey();
+ assertEquals(null, key.getValue());
+ }
+
+ /**
+ * Test copy constructor.
+ */
+ public void testCopyConstructor()
+ {
+ NumberKey key = new NumberKey(new NumberKey("44"));
+ assertEquals("44", key.toString());
+ }
+
+ /**
+ * Test copy constructor.
+ */
+ public void testCopyConstructorNullValue()
+ {
+ NumberKey key = new NumberKey((NumberKey) null);
+ assertEquals(null, key.getValue());
+ }
+
+ /**
+ * Test copy constructor.
+ */
+ public void testBigDecimalConstructor()
+ {
+ NumberKey key = new NumberKey(new BigDecimal("20.42"));
+ assertEquals(new BigDecimal("20.42"), key.getValue());
}
/**
- * Test long constructor
+ * Test long constructor.
*/
public void testLongConstructor()
{
NumberKey key = new NumberKey(9900000000000001L);
assertEquals("9900000000000001", key.toString());
}
+
+ /**
+ * Test double constructor.
+ */
+ public void testDoubleConstructor()
+ {
+ NumberKey key = new NumberKey(5d);
+ assertEquals("5", key.toString());
+ }
+
+ /**
+ * Test int constructor.
+ */
+ public void testIntConstructor()
+ {
+ NumberKey key = new NumberKey(432);
+ assertEquals("432", key.toString());
+ }
+
+ /**
+ * Test number constructor.
+ */
+ public void testNumberConstructor()
+ {
+ NumberKey key = new NumberKey(new Integer(432));
+ assertEquals("432", key.toString());
+ }
+
+ /**
+ * Test number constructor with null value.
+ */
+ public void testNumberConstructorNull()
+ {
+ NumberKey key = new NumberKey((Integer) null);
+ assertEquals(null, key.getValue());
+ }
+
+ /**
+ * Test String constructor.
+ */
+ public void testStringConstructor()
+ {
+ NumberKey key = new NumberKey("9900000000000001");
+ assertEquals("9900000000000001", key.toString());
+ }
+
+ /**
+ * Test String constructor with null value.
+ */
+ public void testStringConstructorNull()
+ {
+ NumberKey key = new NumberKey((String) null);
+ assertEquals(null, key.getValue());
+ }
+
+ /**
+ * Test setValue(String) method.
+ */
+ public void testSetValueString()
+ {
+ NumberKey key = new NumberKey();
+ key.setValue("9900000000000001");
+ assertEquals("9900000000000001", key.toString());
+ }
+
+ /**
+ * Test setValue(String) method with null argument.
+ */
+ public void testSetValueStringNull()
+ {
+ NumberKey key = new NumberKey();
+ key.setValue((String) null);
+ assertEquals(null, key.getValue());
+ }
+
+ /**
+ * Test setValue(BigDecimal) method.
+ */
+ public void testSetValueBigDecimal()
+ {
+ NumberKey key = new NumberKey();
+ key.setValue(new BigDecimal("13.56"));
+ assertEquals("13.56", key.toString());
+ }
+
+ /**
+ * Test setValue(NumberKey) method.
+ */
+ public void testSetValueNumberKey()
+ {
+ NumberKey key = new NumberKey();
+ key.setValue(new NumberKey("13.56"));
+ assertEquals("13.56", key.toString());
+ }
+
+ /**
+ * Test setValue(NumberKey) method with null argument.
+ */
+ public void testSetValueNumberKeyNull()
+ {
+ NumberKey key = new NumberKey();
+ key.setValue((NumberKey) null);
+ assertEquals(null, key.getValue());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org