diff options
author | Serhat Yenican <104850907+serhat-yenican-sonarsource@users.noreply.github.com> | 2024-11-14 16:45:11 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-11-19 20:02:53 +0000 |
commit | e355b1927914aec7e22b4c3da98d9e75c48a57d5 (patch) | |
tree | 88ecdf23e495bdc98121ce2c2ba65b57f42d2b74 /server/sonar-db-dao/src/test | |
parent | ae49ca686664b229b51b5f74299d45d87d663e30 (diff) | |
download | sonarqube-e355b1927914aec7e22b4c3da98d9e75c48a57d5.tar.gz sonarqube-e355b1927914aec7e22b4c3da98d9e75c48a57d5.zip |
CODEFIX-192 Add ai code fix enablement to audit logs (#12238)
Diffstat (limited to 'server/sonar-db-dao/src/test')
-rw-r--r-- | server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/ProjectNewValueTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/ProjectNewValueTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/ProjectNewValueTest.java new file mode 100644 index 00000000000..fa95e45897c --- /dev/null +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/audit/model/ProjectNewValueTest.java @@ -0,0 +1,48 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.db.audit.model; + +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.json.simple.parser.ParseException; +import org.junit.jupiter.api.Test; +import org.sonar.db.project.ProjectDto; + +import static org.assertj.core.api.Assertions.assertThat; + +class ProjectNewValueTest { + + @Test + void toString_generatesValidJson() throws ParseException { + var project = new ProjectDto() + .setUuid("uuid") + .setName("name") + .setKey("key") + .setPrivate(true) + .setDescription("description") + .setQualifier("TRK") + .setAiCodeFixEnabled(true); + ProjectNewValue newValue = new ProjectNewValue(project); + + JSONObject jsonObject = (JSONObject) new JSONParser().parse(newValue.toString()); + + assertThat(jsonObject).hasSize(7); + } +} |