From 108e25bce0062be83ab15c587aecfa1e51ba5cf1 Mon Sep 17 00:00:00 2001 From: Julien Camus Date: Tue, 17 Dec 2024 17:37:43 +0100 Subject: SONAR-24004 Replace lambda with method reference --- .../src/main/java/org/sonar/server/ws/WebServiceEngine.java | 2 +- .../src/test/java/org/sonar/server/ws/MessageFormattingUtilsTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'server/sonar-webserver-ws') diff --git a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java index 149e2e84d24..1c51990cc48 100644 --- a/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java +++ b/server/sonar-webserver-ws/src/main/java/org/sonar/server/ws/WebServiceEngine.java @@ -192,7 +192,7 @@ public class WebServiceEngine implements LocalConnector, Startable { } private static boolean isRequestAbortedByClient(Exception exception) { - return Throwables.getCausalChain(exception).stream().anyMatch(t -> t instanceof ClientAbortException); + return Throwables.getCausalChain(exception).stream().anyMatch(ClientAbortException.class::isInstance); } private static boolean isResponseCommitted(Response response) { diff --git a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/MessageFormattingUtilsTest.java b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/MessageFormattingUtilsTest.java index 250cd849bd5..d943cca692b 100644 --- a/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/MessageFormattingUtilsTest.java +++ b/server/sonar-webserver-ws/src/test/java/org/sonar/server/ws/MessageFormattingUtilsTest.java @@ -36,6 +36,7 @@ public class MessageFormattingUtilsTest { public void nullFormattingListShouldBeEmptyList() { assertThat(MessageFormattingUtils.dbMessageFormattingListToWs(null)).isEmpty(); } + @Test public void singleEntryShouldBeIdentical() { DbIssues.MessageFormattings formattings = DbIssues.MessageFormattings.newBuilder() @@ -48,7 +49,7 @@ public class MessageFormattingUtilsTest { assertThat(MessageFormattingUtils.dbMessageFormattingToWs( formattings).get(0)) - .extracting(e -> e.getStart(), e -> e.getEnd(), e -> e.getType()) + .extracting(Common.MessageFormatting::getStart, Common.MessageFormatting::getEnd, Common.MessageFormatting::getType) .containsExactly(0, 4, Common.MessageFormattingType.CODE); } -- cgit v1.2.3