Skip to content

Commit 1a21c65

Browse files
ericg138sonartech
authored andcommitted
NO-JIRA Fix code quality issues
1 parent 69f18f6 commit 1a21c65

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/PersistMeasuresStepIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class PersistMeasuresStepIT {
105105
private final DbClient dbClient = db.getDbClient();
106106

107107
@BeforeEach
108-
public void setUp() {
108+
void setUp() {
109109
MetricDto stringMetricDto = db.measures().insertMetric(m -> m.setKey(STRING_METRIC.getKey()).setValueType(Metric.ValueType.STRING.name()));
110110
MetricDto intMetricDto = db.measures().insertMetric(m -> m.setKey(INT_METRIC.getKey()).setValueType(Metric.ValueType.INT.name()));
111111
MetricDto bestValueMetricDto = db.measures()
@@ -389,14 +389,13 @@ private void insertBranch() {
389389
db.commit();
390390
}
391391

392-
private ComponentDto insertComponent(String key, String uuid) {
392+
private void insertComponent(String key, String uuid) {
393393
ComponentDto componentDto = new ComponentDto()
394394
.setKey(key)
395395
.setUuid(uuid)
396396
.setUuidPath(uuid + ".")
397397
.setBranchUuid(uuid);
398398
db.components().insertComponent(componentDto);
399-
return componentDto;
400399
}
401400

402401
private PersistMeasuresStep step() {

sonar-core/src/test/java/org/sonar/core/issue/DefaultIssueTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
import static org.assertj.core.api.Assertions.assertThat;
3333
import static org.assertj.core.api.Assertions.assertThatThrownBy;
34-
import static org.junit.Assert.fail;
34+
import static org.junit.jupiter.api.Assertions.fail;
3535
import static org.mockito.Mockito.mock;
3636
import static org.mockito.Mockito.when;
3737

@@ -107,9 +107,9 @@ void test_equals_and_hashCode() {
107107

108108
@Test
109109
void comments_should_not_be_modifiable() {
110-
DefaultIssue issue = new DefaultIssue().setKey("AAA");
110+
DefaultIssue defaultIssue = new DefaultIssue().setKey("AAA");
111111

112-
List<DefaultIssueComment> comments = issue.defaultIssueComments();
112+
List<DefaultIssueComment> comments = defaultIssue.defaultIssueComments();
113113
assertThat(comments).isEmpty();
114114
DefaultIssueComment defaultIssueComment = new DefaultIssueComment();
115115
try {
@@ -128,42 +128,42 @@ void all_changes_contain_current_change() {
128128
when(issueChangeContext.getExternalUser()).thenReturn("toto");
129129
when(issueChangeContext.getWebhookSource()).thenReturn("github");
130130

131-
DefaultIssue issue = new DefaultIssue()
131+
DefaultIssue defaultIssue = new DefaultIssue()
132132
.setKey("AAA")
133133
.setFieldChange(issueChangeContext, "actionPlan", "1.0", "1.1");
134134

135-
assertThat(issue.changes()).hasSize(1);
136-
FieldDiffs actualDiffs = issue.changes().iterator().next();
135+
assertThat(defaultIssue.changes()).hasSize(1);
136+
FieldDiffs actualDiffs = defaultIssue.changes().iterator().next();
137137
assertThat(actualDiffs.externalUser()).contains(issueChangeContext.getExternalUser());
138138
assertThat(actualDiffs.webhookSource()).contains(issueChangeContext.getWebhookSource());
139139
}
140140

141141
@Test
142142
void setFieldChange_whenAddingChange_shouldUpdateCurrentChange() {
143143
IssueChangeContext issueChangeContext = mock(IssueChangeContext.class);
144-
DefaultIssue issue = new DefaultIssue().setKey("AAA");
144+
DefaultIssue defaultIssue = new DefaultIssue().setKey("AAA");
145145

146-
issue.setFieldChange(issueChangeContext, "actionPlan", "1.0", "1.1");
147-
assertThat(issue.changes()).hasSize(1);
148-
FieldDiffs currentChange = issue.currentChange();
146+
defaultIssue.setFieldChange(issueChangeContext, "actionPlan", "1.0", "1.1");
147+
assertThat(defaultIssue.changes()).hasSize(1);
148+
FieldDiffs currentChange = defaultIssue.currentChange();
149149
assertThat(currentChange).isNotNull();
150150
assertThat(currentChange.get("actionPlan")).isNotNull();
151151
assertThat(currentChange.get("authorLogin")).isNull();
152152

153-
issue.setFieldChange(issueChangeContext, "authorLogin", null, "testuser");
154-
assertThat(issue.changes()).hasSize(1);
153+
defaultIssue.setFieldChange(issueChangeContext, "authorLogin", null, "testuser");
154+
assertThat(defaultIssue.changes()).hasSize(1);
155155
assertThat(currentChange.get("actionPlan")).isNotNull();
156156
assertThat(currentChange.get("authorLogin")).isNotNull();
157157
assertThat(currentChange.get("authorLogin").newValue()).isEqualTo("testuser");
158158
}
159159

160160
@Test
161161
void adding_null_change_has_no_effect() {
162-
DefaultIssue issue = new DefaultIssue();
162+
DefaultIssue defaultIssue = new DefaultIssue();
163163

164-
issue.addChange(null);
164+
defaultIssue.addChange(null);
165165

166-
assertThat(issue.changes()).isEmpty();
166+
assertThat(defaultIssue.changes()).isEmpty();
167167
}
168168

169169
@Test

sonar-scanner-engine/src/test/java/org/sonar/scanner/scan/DeprecatedPropertiesWarningGeneratorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class DeprecatedPropertiesWarningGeneratorTest {
5151
analysisWarnings, environmentInformation);
5252

5353
@Before
54-
public void setUp() throws Exception {
54+
public void setUp() {
5555
settings.removeProperty(CoreProperties.LOGIN);
5656
when(environmentInformation.getKey()).thenReturn("ScannerCLI");
5757
}

0 commit comments

Comments
 (0)