mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 11:35:29 -04:00
Fixed test case + code clean-up.
This commit is contained in:
parent
8dcfb46bdb
commit
17f3b97699
@ -91,7 +91,6 @@ public class NumberConverter implements PropertyConverter {
|
||||
|
||||
if (pFormat == null) {
|
||||
// Use system default format, using default locale
|
||||
// format = NumberFormat.getNumberInstance();
|
||||
format = sDefaultFormat;
|
||||
}
|
||||
else {
|
||||
@ -160,7 +159,6 @@ public class NumberConverter implements PropertyConverter {
|
||||
try {
|
||||
// Convert to string, default way
|
||||
if (StringUtil.isEmpty(pFormat)) {
|
||||
// return NumberFormat.getNumberInstance().format(pObject);
|
||||
return sDefaultFormat.format(pObject);
|
||||
}
|
||||
|
||||
@ -196,13 +194,11 @@ public class NumberConverter implements PropertyConverter {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// ...and store in cache
|
||||
sFormats.put(key, format);
|
||||
}
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,9 @@ package com.twelvemonkeys.lang;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* BeanUtilTestCase
|
||||
@ -95,7 +94,7 @@ public class BeanUtilTestCase extends TestCase {
|
||||
|
||||
map.put("stringValue", 1);
|
||||
map.put("intValue", "2");
|
||||
map.put("doubleValue", NumberFormat.getNumberInstance().format(0.3)); // Note, format is locale specific...
|
||||
map.put("doubleValue", ".3");
|
||||
|
||||
try {
|
||||
BeanUtil.configure(bean, map);
|
||||
@ -106,7 +105,7 @@ public class BeanUtilTestCase extends TestCase {
|
||||
|
||||
assertEquals("1", bean.getStringValue());
|
||||
assertEquals(2, bean.getIntValue());
|
||||
assertEquals(.3, bean.getDoubleValue());
|
||||
assertEquals(0.3, bean.getDoubleValue());
|
||||
}
|
||||
|
||||
public void testConfigureAmbigious1() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user