gpt4 book ai didi

java - 组件测试方法

转载 作者:行者123 更新时间:2023-11-28 21:29:29 28 4
gpt4 key购买 nike

我有一个 java 组件(独立应用程序),它从 activemq(POJOs) 读取请求并写入 TCP 套接字,从 TCP 套接字读取响应并写入 activemq。

request -> activemq -> component -> tcp -> component -> activemq -> response

测试此组件的最佳方法是什么?我不想依赖从 activemq 写入和读取 POJO 的上游应用程序和从 TCP 套接字读取和写入的下游应用程序。

最佳答案

I do not want to depend on upstream application that writes and reads the POJO's from activemq and downstream application that reads and writes from TCP socket.

这意味着您需要使用模拟框架模拟那些外部协作者

您将模拟 activemqtcp,如您的图表所示,您的 component 将是真实实例。

关于java - 组件测试方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28287206/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com