I need to test the interactions between 2 ore more java clients in a complete end-to-end test.
Without the GUIs ideally it should be something similar to (Junit syntax):
@Test
public void EndToEndTest(){
App firstApp = new App();
App secondApp = new App();
String msg = "something";
firstApp.send(msg); //this method will magically send msg to secondApp
String msgReceived = secondApp.getLastMsg();
AssertEquals(msgReceived, msg);
}
The code above is not what I want because it makes the "apps" run on the same VM.
The solution that I was able to think on my own was to write a fake main that instantiates the secondApps and writes all its output on a file, launch it with a system call and then check the result but it seems to be a real overkill. Moreover with a strategy like that it would be harder (if not impossible) to test also the GUI.
Thank you for your help.