I am using sitebricks and I have to test Reply using jmock, but the object is not interface, so i cannot mock it. Here is some code:
@Get
Reply<Product> view() {
return Reply.with(new Product("Anti-ageing cure"))
.as(Json.class);
}
The only thoughts in my minds are to fake Reply something like:
public class ReplyFake extends Reply{
....reply methods....
}
But i am not sure it is best practice.
First make you own assertion class :
and the test:
and the service class:
code of assertion class taken from here: https://gist.github.com/AdelinGhanaem/4072405/