|
From: <lh...@us...> - 2008-08-06 14:54:46
|
Revision: 58
http://tmapi.svn.sourceforge.net/tmapi/?rev=58&view=rev
Author: lheuer
Date: 2008-08-06 14:54:56 +0000 (Wed, 06 Aug 2008)
Log Message:
-----------
Aligned test to Exception change in DatatypeAware
Modified Paths:
--------------
trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java
Modified: trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java 2008-08-06 14:04:00 UTC (rev 57)
+++ trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java 2008-08-06 14:54:56 UTC (rev 58)
@@ -13,6 +13,7 @@
*/
package org.tmapi.core;
+import java.math.BigDecimal;
import java.math.BigInteger;
/**
@@ -77,7 +78,6 @@
assertFailFloat(dt);
assertFailLong(dt);
assertFailDecimal(dt);
- assertFailLocator(dt);
}
public void testStringExplicit() {
@@ -91,7 +91,6 @@
assertFailFloat(dt);
assertFailLong(dt);
assertFailDecimal(dt);
- assertFailLocator(dt);
}
public void testInteger() {
@@ -101,24 +100,23 @@
assertEquals(value.toString(), dt.getValue());
assertEquals(_xsdInteger, dt.getDatatype());
assertEquals(value, dt.integerValue());
- assertFailInt(dt);
- assertFailFloat(dt);
- assertFailLong(dt);
- assertFailDecimal(dt);
- assertFailLocator(dt);
+ assertEquals(BigDecimal.TEN, dt.decimalValue());
+ assertEquals(10L, dt.longValue());
+ assertEquals(10, dt.intValue());
+ assertEquals(10.0F, dt.floatValue());
}
public void testIntegerExplicit() {
final BigInteger value = BigInteger.TEN;
final DatatypeAware dt = getDatatypeAware();
dt.setValue(value.toString(), _xsdInteger);
- assertEquals(value, dt.getValue());
+ assertEquals(value.toString(), dt.getValue());
assertEquals(_xsdInteger, dt.getDatatype());
- assertFailInt(dt);
- assertFailFloat(dt);
- assertFailLong(dt);
- assertFailDecimal(dt);
- assertFailLocator(dt);
+ assertEquals(value, dt.integerValue());
+ assertEquals(BigDecimal.TEN, dt.decimalValue());
+ assertEquals(10L, dt.longValue());
+ assertEquals(10, dt.intValue());
+ assertEquals(10.0F, dt.floatValue());
}
protected void assertFailInteger(final DatatypeAware dt) {
@@ -126,7 +124,7 @@
dt.integerValue();
fail("Expected a failure for converting the value to 'BigInteger'");
}
- catch (IllegalStateException ex) {
+ catch (NumberFormatException ex) {
// noop.
}
}
@@ -136,7 +134,7 @@
dt.intValue();
fail("Expected a failure for converting the value to 'int'");
}
- catch (IllegalStateException ex) {
+ catch (NumberFormatException ex) {
// noop.
}
}
@@ -146,7 +144,7 @@
dt.floatValue();
fail("Expected a failure for converting the value to 'float'");
}
- catch (IllegalStateException ex) {
+ catch (NumberFormatException ex) {
// noop.
}
}
@@ -156,7 +154,7 @@
dt.decimalValue();
fail("Expected a failure for converting the value to 'BigDecimal'");
}
- catch (IllegalStateException ex) {
+ catch (NumberFormatException ex) {
// noop.
}
}
@@ -166,7 +164,7 @@
dt.longValue();
fail("Expected a failure for converting the value to 'long'");
}
- catch (IllegalStateException ex) {
+ catch (NumberFormatException ex) {
// noop.
}
}
@@ -176,7 +174,7 @@
dt.locatorValue();
fail("Expected a failure for converting the value to 'Locator'");
}
- catch (IllegalStateException ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|