Search in sources :

Example 1 with UuidFactory

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"));
}
Also used : UuidFactory(org.sonar.core.util.UuidFactory) SnapshotDto(org.sonar.db.component.SnapshotDto) ComponentDto(org.sonar.db.component.ComponentDto) WsActionTester(org.sonar.server.ws.WsActionTester) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 UuidFactory (org.sonar.core.util.UuidFactory)1 ComponentDto (org.sonar.db.component.ComponentDto)1 SnapshotDto (org.sonar.db.component.SnapshotDto)1 WsActionTester (org.sonar.server.ws.WsActionTester)1