use of org.sonar.db.qualityprofile.QProfileChangeQuery in project sonarqube by SonarSource.
the class ChangelogLoaderTest method return_change_with_only_required_fields.
@Test
public void return_change_with_only_required_fields() {
insertChange("C1", ActiveRuleChange.Type.ACTIVATED, A_DATE, null, null);
QProfileChangeQuery query = new QProfileChangeQuery(A_PROFILE_KEY);
ChangelogLoader.Change change = underTest.load(dbSession, query).getChanges().get(0);
assertThat(change.getKey()).isEqualTo("C1");
assertThat(change.getCreatedAt()).isEqualTo(A_DATE);
assertThat(change.getType()).isEqualTo(ActiveRuleChange.Type.ACTIVATED.name());
// optional fields are null or empty
assertThat(change.getInheritance()).isNull();
assertThat(change.getRuleKey()).isNull();
assertThat(change.getRuleName()).isNull();
assertThat(change.getSeverity()).isNull();
assertThat(change.getUserLogin()).isNull();
assertThat(change.getUserName()).isNull();
assertThat(change.getParams()).isEmpty();
}
use of org.sonar.db.qualityprofile.QProfileChangeQuery in project sonarqube by SonarSource.
the class ChangelogLoaderTest method return_empty_changelog.
@Test
public void return_empty_changelog() {
QProfileChangeQuery query = new QProfileChangeQuery("P1");
ChangelogLoader.Changelog changelog = underTest.load(dbSession, query);
assertThat(changelog.getTotal()).isEqualTo(0);
assertThat(changelog.getChanges()).isEmpty();
}
Aggregations