@Test public void search_json_example() { ComponentDto jdk7 = insertJdk7(); ComponentDto cLang = insertClang(); dbClient .componentLinkDao() .insert( dbSession, new ComponentLinkDto() .setComponentUuid(jdk7.uuid()) .setHref("http://www.oracle.com") .setType(ComponentLinkDto.TYPE_HOME_PAGE) .setName("Home")); dbClient .componentLinkDao() .insert( dbSession, new ComponentLinkDto() .setComponentUuid(jdk7.uuid()) .setHref("http://download.java.net/openjdk/jdk8/") .setType(ComponentLinkDto.TYPE_SOURCES) .setName("Sources")); long oneTime = DateUtils.parseDateTime("2016-06-10T13:17:53+0000").getTime(); long anotherTime = DateUtils.parseDateTime("2016-06-11T14:25:53+0000").getTime(); SnapshotDto jdk7Snapshot = dbClient.snapshotDao().insert(dbSession, newAnalysis(jdk7).setCreatedAt(oneTime)); SnapshotDto cLangSnapshot = dbClient.snapshotDao().insert(dbSession, newAnalysis(cLang).setCreatedAt(anotherTime)); dbClient .measureDao() .insert( dbSession, newMeasureDto(alertStatusMetric, jdk7, jdk7Snapshot).setData(Level.ERROR.name())); dbClient .measureDao() .insert( dbSession, newMeasureDto(alertStatusMetric, cLang, cLangSnapshot).setData(Level.OK.name())); insertUserPermission(UserRole.ADMIN, user.getId(), jdk7.getId()); insertUserPermission(UserRole.ADMIN, user.getId(), cLang.getId()); db.commit(); System.setProperty("user.timezone", "UTC"); String result = ws.newRequest().execute().getInput(); assertJson(result).isSimilarTo(getClass().getResource("search_my_projects-example.json")); }