@Test
  public void search() throws Exception {
    Activity activity = new Activity();
    activity.setType(Activity.Type.ANALYSIS_REPORT);
    activity.setAction("THE_ACTION");
    activity.setMessage("THE_MSG");
    activity.setData("foo", "bar");
    service.save(activity);

    WsTester.TestRequest request = tester.wsTester().newGetRequest("api/activities", "search");
    WsTester.Result result = request.execute();
    assertThat(result.outputAsString()).contains("\"total\":1");
    assertThat(result.outputAsString()).contains("\"type\":\"ANALYSIS_REPORT\"");
    assertThat(result.outputAsString()).contains("\"details\":{\"foo\":\"bar\"}");
  }
  @Test
  public void search() throws Exception {
    Activity activity1 = new Activity();
    activity1.setType(Activity.Type.ANALYSIS_REPORT);
    activity1.setAction("LOG_ANALYSIS_REPORT");
    activity1.setData("projectKey", "P1");
    activity1.setData("projectName", "POne");
    activity1.setData("projectUuid", "U1");
    activity1.setData("status", AnalysisReportDto.Status.SUCCESS);
    activity1.setData("submittedAt", new Date());
    activityService.save(activity1);

    Activity activity2 = new Activity();
    activity2.setType(Activity.Type.ANALYSIS_REPORT);
    activity2.setAction("LOG_ANALYSIS_REPORT");
    activity2.setData("projectKey", "P2");
    activity2.setData("projectName", "PTwo");
    activity2.setData("projectUuid", "U2");
    activity2.setData("status", AnalysisReportDto.Status.FAILED);
    activity2.setData("submittedAt", new Date());
    activityService.save(activity2);

    userSessionRule.setGlobalPermissions(GlobalPermissions.SYSTEM_ADMIN);

    WsTester.TestRequest request = tester.wsTester().newGetRequest("api/computation", "history");
    request.execute().assertJson(getClass(), "list_history_reports.json");
  }