Skip to content

Commit 93fb26c

Browse files
authored
Apply sonar improvements. (#161)
1 parent a32b55d commit 93fb26c

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM eclipse-temurin:17-jdk AS builder-base
1+
FROM eclipse-temurin:21-jdk AS builder-base
22
RUN apt-get update && \
33
apt-get install -y --no-install-recommends \
4-
dos2unix \
54
binutils \
5+
dos2unix \
66
fakeroot \
77
rpm && \
88
rm -rf /var/lib/apt/lists/*

src/test/java/com/github/mfl28/boundingboxeditor/BoundingBoxEditorTestBase.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ protected static Stage getTopModalStage(FxRobot robot, String title) {
113113
// It is needed to get the first found modal window.
114114
return robot.listWindows()
115115
.stream()
116-
.filter(window -> window instanceof Stage)
117-
.map(window -> (Stage) window)
116+
.filter(Stage.class::isInstance)
117+
.map(Stage.class::cast)
118118
.filter(stage -> stage.getModality() == Modality.APPLICATION_MODAL)
119119
.filter(stage -> stage.getTitle().equals(title))
120120
.findFirst()
@@ -247,7 +247,7 @@ protected void onStart(Stage stage) {
247247
}
248248

249249
@AfterEach
250-
protected void tearDown() throws TimeoutException {
250+
void tearDown() throws TimeoutException {
251251
FxToolkit.cleanupStages();
252252
FxToolkit.hideStage();
253253
// Make sure FileChangeWatcher is interrupted.
@@ -554,8 +554,8 @@ private <T extends Node> boolean nodePresentAndVisibleAs(FxRobot robot, String i
554554
private boolean isTopModalStagePresent(FxRobot robot) {
555555
return robot.listWindows()
556556
.stream()
557-
.filter(window -> window instanceof Stage)
558-
.map(window -> (Stage) window)
557+
.filter(Stage.class::isInstance)
558+
.map(Stage.class::cast)
559559
.anyMatch(stage -> stage.getModality() == Modality.APPLICATION_MODAL);
560560
}
561561

src/test/java/com/github/mfl28/boundingboxeditor/controller/ControllerTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ void onExportAnnotation_PVOC_WhenPreviouslyImportedAnnotation_ShouldProduceEquiv
129129
.isHasAssignedBoundingShapes()
130130
&& mainView.getCurrentBoundingShapes()
131131
.stream()
132-
.filter(viewable -> viewable instanceof BoundingBoxView)
132+
.filter(BoundingBoxView.class::isInstance)
133133
.count() == 8
134134
&& mainView.getCurrentBoundingShapes()
135135
.stream()
136-
.filter(viewable -> viewable instanceof BoundingPolygonView)
136+
.filter(BoundingPolygonView.class::isInstance)
137137
.count() == 1),
138138
() -> saveScreenshotAndReturnMessage(testinfo,
139139
"Bounding shape counts did not match " +
@@ -273,11 +273,11 @@ void onExportAnnotation_YOLO_WhenPreviouslyImportedAnnotation_ShouldProduceEquiv
273273
.isHasAssignedBoundingShapes()
274274
&& mainView.getCurrentBoundingShapes()
275275
.stream()
276-
.filter(viewable -> viewable instanceof BoundingBoxView)
276+
.filter(BoundingBoxView.class::isInstance)
277277
.count() == 9
278278
&& mainView.getCurrentBoundingShapes()
279279
.stream()
280-
.filter(viewable -> viewable instanceof BoundingPolygonView)
280+
.filter(BoundingPolygonView.class::isInstance)
281281
.count() == 1),
282282
() -> saveScreenshotAndReturnMessage(testinfo,
283283
"Bounding shape counts did not match " +
@@ -407,11 +407,11 @@ void onExportAnnotation_JSON_WhenPreviouslyImportedAnnotation_ShouldProduceEquiv
407407
.isHasAssignedBoundingShapes()
408408
&& mainView.getCurrentBoundingShapes()
409409
.stream()
410-
.filter(viewable -> viewable instanceof BoundingBoxView)
410+
.filter(BoundingBoxView.class::isInstance)
411411
.count() == 8
412412
&& mainView.getCurrentBoundingShapes()
413413
.stream()
414-
.filter(viewable -> viewable instanceof BoundingPolygonView)
414+
.filter(BoundingPolygonView.class::isInstance)
415415
.count() == 1),
416416
() -> saveScreenshotAndReturnMessage(testinfo,
417417
"Bounding shape counts did not match " +
@@ -1227,10 +1227,10 @@ void onExportAnnotation_CSV_WhenPreviouslyImportedAnnotation_ShouldProduceEquiva
12271227
.isHasAssignedBoundingShapes()
12281228
&& mainView.getCurrentBoundingShapes()
12291229
.stream()
1230-
.filter(viewable -> viewable instanceof BoundingBoxView)
1230+
.filter(BoundingBoxView.class::isInstance)
12311231
.count() == 3
12321232
&& mainView.getCurrentBoundingShapes()
1233-
.stream().noneMatch(viewable -> viewable instanceof BoundingPolygonView)),
1233+
.stream().noneMatch(BoundingPolygonView.class::isInstance)),
12341234
() -> saveScreenshotAndReturnMessage(testinfo,
12351235
"Bounding shape counts did not match " +
12361236
"within " + TIMEOUT_DURATION_IN_SEC +

0 commit comments

Comments
 (0)