Statistics { @GET @Path("/earnings/sumovermonth/{username}") public List<SumYearMonth> earningsSumOverMonth(@PathParam("username") String username) { return ukelonn.earningsSumOverMonth(username); }  @GET @Path("/earnings/sumoveryear/{username}") List<SumYear> earningsSumOverYear(@PathParam("username") String username); @GET @Path("/earnings/sumovermonth/{username}") List<SumYearMonth> earningsSumOverMonth(@PathParam("username") String username);  }
@Test public void testEarningsSumOverMonth() { Statistics resource = new Statistics(); UkelonnService ukelonn = mock(UkelonnService.class); when(ukelonn.earningsSumOverMonth(eq("jad"))).thenReturn(Arrays.asList(new SumYearMonth(125.0, 2016, 7))); resource.ukelonn = ukelonn; String username = "jad"; List<SumYearMonth> earningsSumOverYear = resource.earningsSumOverMonth(username); assertThat(earningsSumOverYear).isNotEmpty(); assertEquals(2016, earningsSumOverYear.get(0).getYear()); }