【问题标题】:Attaining the data in json format from the payload which is available as "org.mule.munit.common.util.ReusableByteArrayInputStream@53534c15" in mule 3从 mule 3 中的“org.mule.munit.common.util.ReusableByteArrayInputStream@53534c15”有效负载中获取 json 格式的数据
【发布时间】:2020-05-28 08:53:31
【问题描述】:

我需要真正的有效负载 json 数据才能针对 munit 中的另一个硬编码 json 文件(mule 3.9 和 dataweave 1)断言它。问题是有效负载在有效负载下显示为“org.mule.munit.common.util.ReusableByteArrayInputStream@53534c15”。当我将其转换为 java 时,我可以看到数据,但不是 json 格式。如何提取此字节数组流中的 json 以便能够针对 json 硬编码文件对其进行断言。

【问题讨论】:

    标签: json mule dataweave


    【解决方案1】:

    我通过使用“字节到字符串”块解决了它

    然后,我添加了“Assert Equals”块,但请确保将两个值都设置为这样的格式。

    #[payload.replaceAll("\\s+","")]
    
    #[getResource('sample.json').asString().replaceAll("\\s+","")]
    

    这正是我需要的。

    【讨论】:

      猜你喜欢
      • 2020-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多