use of org.sonar.core.util.UuidFactory in project sonarqube by SonarSource.
the class CreateEventActionTest method json_example.
@Test
public void json_example() {
ComponentDto project = db.components().insertProject();
SnapshotDto analysis = dbClient.snapshotDao().insert(dbSession, SnapshotTesting.newAnalysis(project).setUuid("A2"));
db.commit();
uuidFactory = mock(UuidFactory.class);
when(uuidFactory.create()).thenReturn("E1");
ws = new WsActionTester(new CreateEventAction(dbClient, uuidFactory, system, userSession));
logInAsProjectAdministrator(project);
String result = ws.newRequest().setParam(PARAM_ANALYSIS, analysis.getUuid()).setParam(PARAM_CATEGORY, OTHER.name()).setParam(PARAM_NAME, "My Custom Event").execute().getInput();
assertJson(result).isSimilarTo(getClass().getResource("create_event-example.json"));
}
Aggregations