我有一个 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.
这意味着您需要使用模拟框架模拟那些外部协作者。
您将模拟 activemq
和 tcp
,如您的图表所示,您的 component
将是真实实例。
关于java - 组件测试方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28287206/