Skip to content

Commit f751ace

Browse files
committed
fixed tests
1 parent 7e5106d commit f751ace

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

org.springframework.context/src/test/java/org/springframework/format/number/NumberFormattingTests.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
1-
package org.springframework.format.number;
1+
/*
2+
* Copyright 2002-2009 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
216

3-
import static org.junit.Assert.assertEquals;
17+
package org.springframework.format.number;
418

519
import java.math.BigDecimal;
620
import java.util.Locale;
721

822
import org.junit.After;
23+
import static org.junit.Assert.*;
924
import org.junit.Before;
1025
import org.junit.Test;
26+
1127
import org.springframework.beans.MutablePropertyValues;
1228
import org.springframework.context.i18n.LocaleContextHolder;
29+
import org.springframework.core.convert.support.ConversionServiceFactory;
1330
import org.springframework.format.annotation.NumberFormat;
1431
import org.springframework.format.annotation.NumberFormat.Style;
1532
import org.springframework.format.support.FormattingConversionService;
1633
import org.springframework.validation.DataBinder;
1734

35+
/**
36+
* @author Keith Donald
37+
* @author Juergen Hoeller
38+
*/
1839
public class NumberFormattingTests {
1940

2041
private FormattingConversionService conversionService = new FormattingConversionService();
@@ -23,6 +44,7 @@ public class NumberFormattingTests {
2344

2445
@Before
2546
public void setUp() {
47+
ConversionServiceFactory.addDefaultConverters(conversionService);
2648
conversionService.addFormatterForFieldType(Number.class, new NumberFormatter());
2749
conversionService.addFormatterForFieldAnnotation(new NumberFormatAnnotationFormatterFactory());
2850
LocaleContextHolder.setLocale(Locale.US);

org.springframework.context/src/test/java/org/springframework/validation/DataBinderTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2009 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
4343
import org.springframework.context.i18n.LocaleContextHolder;
4444
import org.springframework.context.support.ResourceBundleMessageSource;
4545
import org.springframework.context.support.StaticMessageSource;
46+
import org.springframework.core.convert.support.ConversionServiceFactory;
4647
import org.springframework.format.number.NumberFormatter;
4748
import org.springframework.format.support.FormattingConversionService;
4849
import org.springframework.util.StringUtils;
@@ -299,6 +300,7 @@ public void testBindingWithFormatter() {
299300
TestBean tb = new TestBean();
300301
DataBinder binder = new DataBinder(tb);
301302
FormattingConversionService conversionService = new FormattingConversionService();
303+
ConversionServiceFactory.addDefaultConverters(conversionService);
302304
conversionService.addFormatterForFieldType(Float.class, new NumberFormatter());
303305
binder.setConversionService(conversionService);
304306
MutablePropertyValues pvs = new MutablePropertyValues();

0 commit comments

Comments
 (0)