This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 86b5b17ce3 Fixed flaky test
     new 14bf658b2b Merge pull request #3401 from wang3820/fix-flaky
86b5b17ce3 is described below

commit 86b5b17ce345d855a25835d94bb02c956abce18c
Author: wang3820 <[email protected]>
AuthorDate: Thu Nov 16 13:33:59 2023 -0600

    Fixed flaky test
---
 .../core/row/value/ValueMetaAvroRecordTest.java    | 28 ++++++++++++----------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git 
a/core/src/test/java/org/apache/hop/core/row/value/ValueMetaAvroRecordTest.java 
b/core/src/test/java/org/apache/hop/core/row/value/ValueMetaAvroRecordTest.java
index 2dafbc2b71..6b4fc6f305 100644
--- 
a/core/src/test/java/org/apache/hop/core/row/value/ValueMetaAvroRecordTest.java
+++ 
b/core/src/test/java/org/apache/hop/core/row/value/ValueMetaAvroRecordTest.java
@@ -18,6 +18,8 @@
 
 package org.apache.hop.core.row.value;
 
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.avro.Schema;
 import org.apache.avro.generic.GenericData;
 import org.apache.avro.generic.GenericRecord;
@@ -27,7 +29,6 @@ import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.junit.BeforeClass;
 import org.junit.Test;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.DataInputStream;
@@ -166,21 +167,22 @@ public class ValueMetaAvroRecordTest {
 
     JSONObject jValue = new JSONObject();
     valueMeta.storeMetaInJson(jValue);
-
-    String valueJson = jValue.toJSONString();
-    assertEquals(
-        
"{\"schema\":{\"name\":\"all_values\",\"namespace\":\"hop.apache.org\",\"doc\":"
 +
-                "\"No documentation URL for 
now\",\"type\":\"record\",\"fields\":[{\"name\":\"id\",\"type\":" +
-                
"[\"long\",\"null\"]},{\"name\":\"sysdate\",\"type\":[\"string\",\"null\"]}," +
-                
"{\"name\":\"num\",\"type\":[\"double\",\"null\"]},{\"name\":\"int\",\"type\":" 
+
-                
"[\"long\",\"null\"]},{\"name\":\"str\",\"type\":[\"string\",\"null\"]}," +
-                
"{\"name\":\"uuid\",\"type\":[\"string\",\"null\"]}]},\"precision\":-1,\"name\":"
 +
-                "\"test\",\"length\":-1,\"conversionMask\":null,\"type\":20}",
-        valueJson);
+    ObjectMapper mapper = new ObjectMapper();
+    JsonNode valueNode = mapper.readTree(jValue.toJSONString());
+    JsonNode expectJsonNode = mapper.readTree(
+            
"{\"schema\":{\"name\":\"all_values\",\"namespace\":\"hop.apache.org\",\"doc\":"
 +
+            "\"No documentation URL for 
now\",\"type\":\"record\",\"fields\":[{\"name\":\"id\",\"type\":" +
+            
"[\"long\",\"null\"]},{\"name\":\"sysdate\",\"type\":[\"string\",\"null\"]}," +
+            
"{\"name\":\"num\",\"type\":[\"double\",\"null\"]},{\"name\":\"int\",\"type\":" 
+
+            
"[\"long\",\"null\"]},{\"name\":\"str\",\"type\":[\"string\",\"null\"]}," +
+            
"{\"name\":\"uuid\",\"type\":[\"string\",\"null\"]}]},\"precision\":-1,\"name\":"
 +
+            "\"test\",\"length\":-1,\"conversionMask\":null,\"type\":20}"
+    );
+    assertEquals(valueNode,expectJsonNode);
 
     // Read it back...
     //
-    JSONObject jLoaded = (JSONObject) new JSONParser().parse(valueJson);
+    JSONObject jLoaded = (JSONObject) new 
JSONParser().parse(valueNode.toString());
 
     ValueMetaAvroRecord loaded = (ValueMetaAvroRecord) 
ValueMetaFactory.loadValueMetaFromJson(jLoaded);
 

Reply via email to