|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2013 the original author or authors. |
| 2 | + * Copyright 2002-2014 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
32 | 32 | import com.fasterxml.jackson.databind.MapperFeature;
|
33 | 33 | import com.fasterxml.jackson.databind.Module;
|
34 | 34 | import com.fasterxml.jackson.databind.ObjectMapper;
|
| 35 | +import com.fasterxml.jackson.databind.PropertyNamingStrategy; |
35 | 36 | import com.fasterxml.jackson.databind.SerializationFeature;
|
36 | 37 | import com.fasterxml.jackson.databind.cfg.DeserializerFactoryConfig;
|
37 | 38 | import com.fasterxml.jackson.databind.cfg.SerializerFactoryConfig;
|
|
49 | 50 |
|
50 | 51 | import org.springframework.beans.FatalBeanException;
|
51 | 52 |
|
52 |
| -import static org.junit.Assert.*; |
| 53 | +import static junit.framework.Assert.assertTrue; |
| 54 | +import static org.junit.Assert.assertEquals; |
| 55 | +import static org.junit.Assert.assertFalse; |
| 56 | +import static org.junit.Assert.assertNotNull; |
| 57 | +import static org.junit.Assert.assertNull; |
| 58 | +import static org.junit.Assert.assertSame; |
53 | 59 |
|
54 | 60 | /**
|
55 | 61 | * Test cases for {@link Jackson2ObjectMapperFactoryBean} class.
|
@@ -186,6 +192,16 @@ private static DeserializerFactoryConfig getDeserializerFactoryConfig(ObjectMapp
|
186 | 192 | return ((BasicDeserializerFactory) objectMapper.getDeserializationContext().getFactory()).getFactoryConfig();
|
187 | 193 | }
|
188 | 194 |
|
| 195 | + @Test |
| 196 | + public void testPropertyNamingStrategy() { |
| 197 | + PropertyNamingStrategy strategy = new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy(); |
| 198 | + this.factory.setPropertyNamingStrategy(strategy); |
| 199 | + this.factory.afterPropertiesSet(); |
| 200 | + |
| 201 | + assertSame(strategy, this.factory.getObject().getSerializationConfig().getPropertyNamingStrategy()); |
| 202 | + assertSame(strategy, this.factory.getObject().getDeserializationConfig().getPropertyNamingStrategy()); |
| 203 | + } |
| 204 | + |
189 | 205 | @Test
|
190 | 206 | public void testCompleteSetup() {
|
191 | 207 | NopAnnotationIntrospector annotationIntrospector = NopAnnotationIntrospector.instance;
|
|
0 commit comments