Skip to content

Commit 7830039

Browse files
author
Zihan Li
committed
address comments
1 parent 4888b3f commit 7830039

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

dao-api/src/main/java/com/linkedin/metadata/dao/utils/RecordUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static String toJsonString(@Nonnull RecordTemplate recordTemplate) {
8181

8282
/**
8383
* Serializes a {@link RecordTemplate} to JSON string.
84-
*Also take test mode as input to control the default value fill in strategy
84+
* Also take test mode as input to control the default value fill in strategy
8585
* @param recordTemplate the record template to serialize
8686
* @return the JSON string serialized using {@link JacksonDataTemplateCodec}.
8787
*/

dao-api/src/test/java/com/linkedin/metadata/dao/utils/RecordUtilsTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.linkedin.testing.PizzaInfo;
2424
import com.linkedin.testing.StringUnion;
2525
import com.linkedin.testing.StringUnionArray;
26+
import com.linkedin.testing.MapValueRecord;
2627
import com.linkedin.testing.singleaspectentity.EntityValue;
2728
import com.linkedin.testing.urn.FooUrn;
2829
import java.io.IOException;
@@ -56,7 +57,7 @@ public void testToJsonString() throws IOException {
5657

5758
@Test
5859
public void testToJsonStringWithDefault() throws IOException {
59-
AspectWithDefaultValue defaultValueAspect = new AspectWithDefaultValue();
60+
AspectWithDefaultValue defaultValueAspect = new AspectWithDefaultValue().setNestedValueWithDefault(new MapValueRecord());
6061
String expected =
6162
loadJsonFromResource("defaultValueAspect.json").replaceAll("\\s+", "").replaceAll("\\n", "").replaceAll("\\r", "");
6263

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2+
"nestedValueWithDefault":{
3+
"mapValueWithDefaultmap":{}
4+
},
25
"valueWithDefault": ""
36
}

testing/test-models/src/main/pegasus/com/linkedin/testing/AspectWithDefaultValue.pdl

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ record AspectWithDefaultValue {
66
* For unit tests
77
*/
88
valueWithDefault: string = ""
9+
nestedValueWithDefault: record MapValueRecord {mapValueWithDefaultmap: map[string, string] = { }}
910
}

0 commit comments

Comments
 (0)