gnodet-bot commented on code in PR #13848:
URL: https://github.com/apache/maven/pull/13848#discussion_r4480226043
##########
impl/maven-cli/src/main/java/org/apache/maven/cling/transfer/FileSizeFormat.java:
##########
@@ -151,17 +153,23 @@ public void format(MessageBuilder builder, long size,
ScaleUnit unit) {
format(builder, size, unit, false);
}
+ void formatRate(StringBuilder builder, double rate) {
+ builder.append(formatRate(rate));
+ }
Review Comment:
🔍 **Missing Javadoc:** New package-private `formatRate(StringBuilder,
double)` overload has no Javadoc. It's the only public-class method added in
this PR without documentation. A one-liner explaining why this overload exists
alongside the `MessageBuilder` variant would help future readers.
```suggestion
/**
* Formats a transfer rate into the given builder.
* @see #formatRate(org.apache.maven.api.services.MessageBuilder, double)
*/
void formatRate(StringBuilder builder, double rate) {
builder.append(formatRate(rate));
}
```
##########
impl/maven-cli/src/test/java/org/apache/maven/cling/transfer/Slf4jMavenTransferListenerTest.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.cling.transfer;
+
+import java.io.File;
+import java.time.Clock;
+import java.time.ZoneOffset;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.maven.api.MonotonicClock;
+import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.eclipse.aether.transfer.TransferEvent;
+import org.eclipse.aether.transfer.TransferResource;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+import org.slf4j.Logger;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+class Slf4jMavenTransferListenerTest {
+
+ @Test
+ void subSecondTransferReportsItsRate() {
Review Comment:
⚠️ **Missing `@ResourceLock`:** `resourceStartedMillisAgo` mutates the
static `TransferResource.clock` field. `FileSizeFormatTest` already uses
`@ResourceLock(Resources.LOCALE)` for the analogous locale mutation — the same
protection is needed here to prevent flaky failures under parallel test
execution.
Also add `import org.junit.jupiter.api.parallel.ResourceLock;` and `import
org.junit.jupiter.api.parallel.Resources;` (already present in
`FileSizeFormatTest` for reference).
```suggestion
@ResourceLock("TransferResource.clock")
@Test
void subSecondTransferReportsItsRate() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]