Skip to content

Commit 2f51e48

Browse files
committed
Fix SonarLint issues
1 parent aae41c0 commit 2f51e48

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

src/main/java/fr/jmini/utils/ecentral/ECentralTask.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private void createPotentialMavenArtifacts() throws IOException {
104104
List<BndEntry> entries = parseBndOutput(bndFileContent);
105105

106106
List<MavenArtifact> result = entries.stream()
107-
.filter(e -> keepEntry(e))
107+
.filter(this::keepEntry)
108108
.map(ECentralTask::toMavenArtifact)
109109
.collect(Collectors.toList());
110110

@@ -192,7 +192,7 @@ private void createMavenArtifacts() throws IOException {
192192
List<MavenArtifact> entries = parseArtifactsFile(getPotentialMavenArtifactsFile());
193193

194194
List<MavenArtifact> result = entries.stream()
195-
.filter(e -> checkArtifactInMavenCentral(e))
195+
.filter(ECentralTask::checkArtifactInMavenCentral)
196196
.collect(Collectors.toList());
197197

198198
writeArtifactsToFile(getMavenArtifactsFile(), result);
@@ -296,8 +296,7 @@ private String createMavenBomContent(List<MavenArtifact> entries) {
296296
sb.append(" </dependencies>\n");
297297
sb.append(" </dependencyManagement>\n");
298298
sb.append("</project>\n");
299-
String s = sb.toString();
300-
return s;
299+
return sb.toString();
301300
}
302301

303302
static String calculateHash(String content, Algorithm algorithm) {
@@ -329,8 +328,7 @@ private void writeArtifactsToFile(Path file, List<MavenArtifact> artifacts) thro
329328
private List<MavenArtifact> parseArtifactsFile(Path file) throws IOException {
330329
Gson gson = new Gson();
331330
String content = Files.readString(file, StandardCharsets.UTF_8);
332-
List<MavenArtifact> artifacts = gson.fromJson(content, TYPE_TOKEN.getType());
333-
return artifacts;
331+
return gson.fromJson(content, TYPE_TOKEN.getType());
334332
}
335333

336334
private Path getDataFolder() {

src/test/java/fr/jmini/utils/ecentral/ECentralTaskTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
import org.junit.jupiter.api.Test;
66

7-
public class ECentralTaskTest {
7+
class ECentralTaskTest {
88
@Test
9-
public void testParseBndEntry() throws Exception {
9+
void testParseBndEntry() throws Exception {
1010
BndEntry result = ECentralTask.parseBndLine("com.company.test.foo [1.12.300]");
1111

1212
assertThat(result.getSymbolicName())
@@ -18,7 +18,7 @@ public void testParseBndEntry() throws Exception {
1818
}
1919

2020
@Test
21-
public void testParseBndEntryWithMultipleVersions() throws Exception {
21+
void testParseBndEntryWithMultipleVersions() throws Exception {
2222
BndEntry result = ECentralTask.parseBndLine("zzz.yyyyyy.xxxxxxx [1.1.400.v20180921-1416, 2.2.400.v20191120-1313]");
2323

2424
assertThat(result.getSymbolicName())
@@ -30,7 +30,7 @@ public void testParseBndEntryWithMultipleVersions() throws Exception {
3030
}
3131

3232
@Test
33-
public void testToMavenArtifact() throws Exception {
33+
void testToMavenArtifact() throws Exception {
3434
MavenArtifact jdtCore = ECentralTask.toMavenArtifact(new BndEntry("org.eclipse.jdt.core", "3.20.0.v20191203-2131"));
3535
assertThat(jdtCore.getGroupId())
3636
.as("groupId")
@@ -66,7 +66,7 @@ public void testToMavenArtifact() throws Exception {
6666
}
6767

6868
@Test
69-
public void testConvertVersion() throws Exception {
69+
void testConvertVersion() throws Exception {
7070
assertThat(ECentralTask.convertVersion("3.12.2.v20161117-1814"))
7171
.as("version")
7272
.isEqualTo("3.12.2");
@@ -76,7 +76,7 @@ public void testConvertVersion() throws Exception {
7676
}
7777

7878
@Test
79-
public void testComputeMavenCentralUrl() throws Exception {
79+
void testComputeMavenCentralUrl() throws Exception {
8080
MavenArtifact a = new MavenArtifact("org.eclipse.platform", "org.eclipse.ant.core", "3.5.600");
8181
assertThat(ECentralTask.computeMavenCentralUrl(a))
8282
.as("url in maven centraal")
@@ -85,7 +85,7 @@ public void testComputeMavenCentralUrl() throws Exception {
8585
}
8686

8787
@Test
88-
public void testCalculateHash() throws Exception {
88+
void testCalculateHash() throws Exception {
8989
String md5 = ECentralTask.calculateHash("test", Algorithm.MD_5);
9090
assertThat(md5).isEqualTo("098f6bcd4621d373cade4e832627b4f6");
9191

src/test/java/fr/jmini/utils/ecentral/RunTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
/**
66
* This test class run the code for different update sites.
77
*/
8-
public class RunTest {
8+
class RunTest {
99

1010
@Test
11-
public void run_4_21() throws Exception {
11+
void run_4_21() throws Exception {
1212
Input input = new Input()
1313
.withReleaseName("2021-09")
1414
.withReleaseVersion("4.21")
@@ -17,7 +17,7 @@ public void run_4_21() throws Exception {
1717
}
1818

1919
@Test
20-
public void run_4_20() throws Exception {
20+
void run_4_20() throws Exception {
2121
Input input = new Input()
2222
.withReleaseName("2021-06")
2323
.withReleaseVersion("4.20")
@@ -26,7 +26,7 @@ public void run_4_20() throws Exception {
2626
}
2727

2828
@Test
29-
public void run_4_19() throws Exception {
29+
void run_4_19() throws Exception {
3030
Input input = new Input()
3131
.withReleaseName("2021-03")
3232
.withReleaseVersion("4.19")
@@ -35,7 +35,7 @@ public void run_4_19() throws Exception {
3535
}
3636

3737
@Test
38-
public void run_4_18() throws Exception {
38+
void run_4_18() throws Exception {
3939
Input input = new Input()
4040
.withReleaseName("2020-12")
4141
.withReleaseVersion("4.18")
@@ -44,7 +44,7 @@ public void run_4_18() throws Exception {
4444
}
4545

4646
@Test
47-
public void run_4_17() throws Exception {
47+
void run_4_17() throws Exception {
4848
Input input = new Input()
4949
.withReleaseName("2020-09")
5050
.withReleaseVersion("4.17")
@@ -53,7 +53,7 @@ public void run_4_17() throws Exception {
5353
}
5454

5555
@Test
56-
public void run_4_16() throws Exception {
56+
void run_4_16() throws Exception {
5757
Input input = new Input()
5858
.withReleaseName("2020-06")
5959
.withReleaseVersion("4.16")
@@ -62,7 +62,7 @@ public void run_4_16() throws Exception {
6262
}
6363

6464
@Test
65-
public void run_4_15() throws Exception {
65+
void run_4_15() throws Exception {
6666
Input input = new Input()
6767
.withReleaseName("2020-03")
6868
.withReleaseVersion("4.15")
@@ -72,7 +72,7 @@ public void run_4_15() throws Exception {
7272

7373
// tag::4_14_test[]
7474
@Test
75-
public void run_4_14() throws Exception {
75+
void run_4_14() throws Exception {
7676
Input input = new Input()
7777
.withReleaseName("2019-12")
7878
.withReleaseVersion("4.14")
@@ -82,7 +82,7 @@ public void run_4_14() throws Exception {
8282
// end::4_14_test[]
8383

8484
@Test
85-
public void run_4_13() throws Exception {
85+
void run_4_13() throws Exception {
8686
Input input = new Input()
8787
.withReleaseName("2019-09")
8888
.withReleaseVersion("4.13")
@@ -91,7 +91,7 @@ public void run_4_13() throws Exception {
9191
}
9292

9393
@Test
94-
public void run_4_12() throws Exception {
94+
void run_4_12() throws Exception {
9595
Input input = new Input()
9696
.withReleaseName("2019-06")
9797
.withReleaseVersion("4.12")
@@ -100,7 +100,7 @@ public void run_4_12() throws Exception {
100100
}
101101

102102
@Test
103-
public void run_4_11() throws Exception {
103+
void run_4_11() throws Exception {
104104
Input input = new Input()
105105
.withReleaseName("2019-03")
106106
.withReleaseVersion("4.11")
@@ -109,7 +109,7 @@ public void run_4_11() throws Exception {
109109
}
110110

111111
@Test
112-
public void run_4_10() throws Exception {
112+
void run_4_10() throws Exception {
113113
Input input = new Input()
114114
.withReleaseName("2018-12")
115115
.withReleaseVersion("4.10")
@@ -118,7 +118,7 @@ public void run_4_10() throws Exception {
118118
}
119119

120120
@Test
121-
public void run_4_9() throws Exception {
121+
void run_4_9() throws Exception {
122122
Input input = new Input()
123123
.withReleaseName("2018-09")
124124
.withReleaseVersion("4.9")
@@ -127,7 +127,7 @@ public void run_4_9() throws Exception {
127127
}
128128

129129
@Test
130-
public void run_4_8() throws Exception {
130+
void run_4_8() throws Exception {
131131
Input input = new Input()
132132
.withReleaseName("Photon")
133133
.withReleaseVersion("4.8")
@@ -136,7 +136,7 @@ public void run_4_8() throws Exception {
136136
}
137137

138138
@Test
139-
public void run_4_7() throws Exception {
139+
void run_4_7() throws Exception {
140140
Input input = new Input()
141141
.withReleaseName("Oxygen")
142142
.withReleaseVersion("4.7")
@@ -145,7 +145,7 @@ public void run_4_7() throws Exception {
145145
}
146146

147147
@Test
148-
public void run_4_6() throws Exception {
148+
void run_4_6() throws Exception {
149149
Input input = new Input()
150150
.withReleaseName("Neon")
151151
.withReleaseVersion("4.6")

0 commit comments

Comments
 (0)