From 00e6745d261829f60f183c511c3273dd08984e1c Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 27 Nov 2009 02:15:48 +0000 Subject: [PATCH] fixed tests git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2527 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../format/number/NumberFormattingTests.java | 26 +++++++++++++++++-- .../validation/DataBinderTests.java | 4 ++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/org.springframework.context/src/test/java/org/springframework/format/number/NumberFormattingTests.java b/org.springframework.context/src/test/java/org/springframework/format/number/NumberFormattingTests.java index c1984bd64b5..7518f116837 100644 --- a/org.springframework.context/src/test/java/org/springframework/format/number/NumberFormattingTests.java +++ b/org.springframework.context/src/test/java/org/springframework/format/number/NumberFormattingTests.java @@ -1,20 +1,41 @@ -package org.springframework.format.number; +/* + * Copyright 2002-2009 the original author or authors. + * + * Licensed 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. + */ -import static org.junit.Assert.assertEquals; +package org.springframework.format.number; import java.math.BigDecimal; import java.util.Locale; import org.junit.After; +import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; + import org.springframework.beans.MutablePropertyValues; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.core.convert.support.ConversionServiceFactory; import org.springframework.format.annotation.NumberFormat; import org.springframework.format.annotation.NumberFormat.Style; import org.springframework.format.support.FormattingConversionService; import org.springframework.validation.DataBinder; +/** + * @author Keith Donald + * @author Juergen Hoeller + */ public class NumberFormattingTests { private FormattingConversionService conversionService = new FormattingConversionService(); @@ -23,6 +44,7 @@ public class NumberFormattingTests { @Before public void setUp() { + ConversionServiceFactory.addDefaultConverters(conversionService); conversionService.addFormatterForFieldType(Number.class, new NumberFormatter()); conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory()); LocaleContextHolder.setLocale(Locale.US); diff --git a/org.springframework.context/src/test/java/org/springframework/validation/DataBinderTests.java b/org.springframework.context/src/test/java/org/springframework/validation/DataBinderTests.java index 67523e51f12..2e6b73b3979 100644 --- a/org.springframework.context/src/test/java/org/springframework/validation/DataBinderTests.java +++ b/org.springframework.context/src/test/java/org/springframework/validation/DataBinderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ import org.springframework.beans.propertyeditors.CustomNumberEditor; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.context.support.StaticMessageSource; +import org.springframework.core.convert.support.ConversionServiceFactory; import org.springframework.format.number.NumberFormatter; import org.springframework.format.support.FormattingConversionService; import org.springframework.util.StringUtils; @@ -299,6 +300,7 @@ public class DataBinderTests extends TestCase { TestBean tb = new TestBean(); DataBinder binder = new DataBinder(tb); FormattingConversionService conversionService = new FormattingConversionService(); + ConversionServiceFactory.addDefaultConverters(conversionService); conversionService.addFormatterForFieldType(Float.class, new NumberFormatter()); binder.setConversionService(conversionService); MutablePropertyValues pvs = new MutablePropertyValues();