@@ -3,6 +3,7 @@ package tech.ydb.yoj.databind.schema
3
3
import org.assertj.core.api.Assertions.assertThat
4
4
import org.junit.BeforeClass
5
5
import org.junit.Test
6
+ import java.util.Map.entry
6
7
7
8
class KotlinSchemaTest {
8
9
@Test
@@ -69,13 +70,21 @@ class KotlinSchemaTest {
69
70
assertThat(schema!! .getField(" notFlatEntity" ).isFlat).isFalse()
70
71
}
71
72
73
+ @Test
74
+ fun testPrivateProp () {
75
+ val ue = UberEntity (null , null , null , null , PrivatePropEntity (42 ))
76
+ assertThat(schema!! .flatten(ue)).containsOnly(entry(" privatePropEntity_privateProp" , 42 ))
77
+ assertThat(schema!! .newInstance(mapOf (" privatePropEntity_privateProp" to 42 ))).isEqualTo(ue)
78
+ }
79
+
72
80
private class TestSchema <T >(entityType : Class <T >) : Schema<T>(entityType)
73
81
74
82
private data class UberEntity (
75
- val entity1 : Entity1 ,
76
- val flatEntity : FlatEntity ,
77
- val twoFieldEntity : TwoFieldEntity ,
78
- val notFlatEntity : NotFlatEntity ,
83
+ val entity1 : Entity1 ? ,
84
+ val flatEntity : FlatEntity ? ,
85
+ val twoFieldEntity : TwoFieldEntity ? ,
86
+ val notFlatEntity : NotFlatEntity ? ,
87
+ val privatePropEntity : PrivatePropEntity
79
88
)
80
89
81
90
private data class Entity1 (val entity2 : Entity2 )
@@ -96,6 +105,10 @@ class KotlinSchemaTest {
96
105
val otherTwoFieldEntity : TwoFieldEntity ,
97
106
)
98
107
108
+ private data class PrivatePropEntity (
109
+ private val privateProp : Int
110
+ )
111
+
99
112
companion object {
100
113
private var schema: Schema <UberEntity >? = null
101
114
0 commit comments