rss latest news: Restfuse review at InfoQ | archive
Fork me on GitHub

Regardless for what you are using an asynchronous mechanism you only have two options to deal with it, Polling or Callbacks. Both methods are supported by restfuse.

When you need to poll an asynchronous service more than once you can use the @Poll annotation. A simple example looks like the one below. The service in this example will be called 5 times as the same as the test method. The response for each request will be injected into the test object and can be tested.

To use a callback to test an asynchronous service you can use the @Callback annotation on you test method. Restfuse will start a server on the defined port and registers a resource. The test fails if the attached resource was not called. Within the resource you can test the incoming request. A simple callback example looks like this.