use of org.sonarqube.ws.Developers.SearchEventsWsResponse in project sonarqube by SonarSource.
the class SearchEventsActionNewIssuesTest method issue_event.
@Test
public void issue_event() {
userSession.logIn().setRoot();
when(server.getPublicRootUrl()).thenReturn("https://sonarcloud.io");
ComponentDto project = db.components().insertPrivateProject();
SnapshotDto analysis = insertAnalysis(project, 1_500_000_000_000L);
insertIssue(project, analysis);
insertIssue(project, analysis);
// will be ignored
insertSecurityHotspot(project, analysis);
issueIndexer.indexAllIssues();
long from = analysis.getCreatedAt() - 1_000_000L;
SearchEventsWsResponse result = ws.newRequest().setParam(PARAM_PROJECTS, project.getKey()).setParam(PARAM_FROM, formatDateTime(from)).executeProtobuf(SearchEventsWsResponse.class);
assertThat(result.getEventsList()).extracting(Event::getCategory, Event::getProject, Event::getMessage, Event::getLink, Event::getDate).containsOnly(tuple("NEW_ISSUES", project.getKey(), format("You have 2 new issues on project '%s'", project.name()), format("https://sonarcloud.io/project/issues?id=%s&createdAfter=%s&assignees=%s&resolved=false", project.getKey(), encode(formatDateTime(from + 1_000L)), userSession.getLogin()), formatDateTime(analysis.getCreatedAt())));
}
Aggregations