AppStoreController { @GET @Path("recommended") @Produces(MediaType.APPLICATION_JSON) public List<AppStoreEntry> get() { AppCatalogSolrClient sc = new AppCatalogSolrClient(); return sc.getRecommendedApps(); } AppStoreController(); @GET @Path("recommended") @Produces(MediaType.APPLICATION_JSON) List<AppStoreEntry> get(); @GET @Path("search") @Produces(MediaType.APPLICATION_JSON) List<AppStoreEntry> search(@QueryParam("q") String keyword); @GET @Path("get/{id}") @Produces(MediaType.APPLICATION_JSON) AppStoreEntry get(@PathParam("id") String id); @POST @Path("register") @Produces(MediaType.APPLICATION_JSON) Response register(Application app);  }
@Test public void testGetRecommended() throws Exception { AppStoreController ac = Mockito.mock(AppStoreController.class); List<AppStoreEntry> actual = new ArrayList<AppStoreEntry>(); when(ac.get()).thenReturn(actual); final List<AppStoreEntry> result = ac.get(); assertEquals(result, actual); }