@ -21,6 +21,8 @@ import static org.junit.Assert.*;
@@ -21,6 +21,8 @@ import static org.junit.Assert.*;
import static org.mockito.Mockito.* ;
import static org.springframework.data.mongodb.core.DBObjectTestUtils.* ;
import lombok.RequiredArgsConstructor ;
import java.math.BigDecimal ;
import java.math.BigInteger ;
import java.net.URL ;
@ -2101,6 +2103,28 @@ public class MappingMongoConverterUnitTests {
@@ -2101,6 +2103,28 @@ public class MappingMongoConverterUnitTests {
assertThat ( converter . read ( ClassWithEnumProperty . class , source ) . enumSet , is ( EnumSet . noneOf ( SampleEnum . class ) ) ) ;
}
/ * *
* @see DATAMONGO - 1831
* /
@Test
public void shouldConvertArrayInConstructorCorrectly ( ) {
DBObject source = new BasicDBObject ( "array" , Collections . emptyList ( ) ) ;
assertThat ( converter . read ( WithArrayInConstructor . class , source ) . array , is ( emptyArray ( ) ) ) ;
}
/ * *
* @see DATAMONGO - 1831
* /
@Test
public void shouldConvertNullForArrayInConstructorCorrectly ( ) {
DBObject source = new BasicDBObject ( ) ;
assertThat ( converter . read ( WithArrayInConstructor . class , source ) . array , is ( nullValue ( ) ) ) ;
}
static class GenericType < T > {
T content ;
}
@ -2451,4 +2475,11 @@ public class MappingMongoConverterUnitTests {
@@ -2451,4 +2475,11 @@ public class MappingMongoConverterUnitTests {
static class TypeWithPropertyInNestedField {
@Field ( "nested.sample" ) String sample ;
}
@RequiredArgsConstructor
static class WithArrayInConstructor {
final String [ ] array ;
}
}