Copilot commented on code in PR #413:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/413#discussion_r2577019256


##########
src/test/java/org/apache/maven/buildcache/its/SkipCacheParamTest.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.buildcache.its;
+
+import java.util.List;
+
+import org.apache.maven.buildcache.its.junit.IntegrationTest;
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.junit.jupiter.api.Test;
+
+@IntegrationTest("src/test/projects/skip-cache-param")
+public class SkipCacheParamTest {
+
+    @Test
+    void skipCacheAndCacheDisabled(Verifier verifier) throws 
VerificationException {
+        // cache.enabled=false , cache.skipCache=false => cache should NOT be 
created
+        verifier.setAutoclean(false);
+        verifier.setLogFileName("../log-0.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=false");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=false");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Building jar:");
+        verifyTextNotInLog(verifier, "Saved Build to local file:");
+    }
+
+    @Test
+    void cacheEnabledShouldCreateCache(Verifier verifier) throws 
VerificationException {
+        // cache.enabled=true , cache.skipCache=false => cache should be 
created, normal scenario
+        verifier.setAutoclean(false);
+        verifier.setLogFileName("../log-1.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=true");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=false");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Going to calculate checksum for project");
+    }
+
+    @Test
+    void disabledCacheAndSkipCacheShouldNotCreateCache(Verifier verifier) 
throws VerificationException {
+        // cache.enabled=false , cache.skipCache=true => cache should NOT be 
created
+        verifier.setAutoclean(false);
+
+        verifier.setLogFileName("../log-2.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=false");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=true");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Building jar:");
+        verifyTextNotInLog(verifier, "Saved Build to local file:");
+    }
+
+    @Test
+    void enabledCacheAndSkippingCacheShouldNotCreateCache(Verifier verifier) 
throws VerificationException {

Review Comment:
   The test method name and comment contradict each other. The method is named 
`enabledCacheAndSkippingCacheShouldNotCreateCache` but the comment on line 78 
states "cache should not be read, only be created" and the test verifies on 
line 87 that the cache is saved. The method name should reflect that cache IS 
created but not read/restored.
   ```suggestion
       void enabledCacheAndSkippingCacheShouldCreateButNotReadCache(Verifier 
verifier) throws VerificationException {
   ```



##########
src/test/java/org/apache/maven/buildcache/its/SkipCacheParamTest.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.buildcache.its;
+
+import java.util.List;
+
+import org.apache.maven.buildcache.its.junit.IntegrationTest;
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.junit.jupiter.api.Test;
+
+@IntegrationTest("src/test/projects/skip-cache-param")
+public class SkipCacheParamTest {
+
+    @Test
+    void skipCacheAndCacheDisabled(Verifier verifier) throws 
VerificationException {
+        // cache.enabled=false , cache.skipCache=false => cache should NOT be 
created
+        verifier.setAutoclean(false);
+        verifier.setLogFileName("../log-0.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=false");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=false");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Building jar:");
+        verifyTextNotInLog(verifier, "Saved Build to local file:");
+    }
+
+    @Test
+    void cacheEnabledShouldCreateCache(Verifier verifier) throws 
VerificationException {
+        // cache.enabled=true , cache.skipCache=false => cache should be 
created, normal scenario
+        verifier.setAutoclean(false);
+        verifier.setLogFileName("../log-1.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=true");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=false");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Going to calculate checksum for project");
+    }
+
+    @Test
+    void disabledCacheAndSkipCacheShouldNotCreateCache(Verifier verifier) 
throws VerificationException {
+        // cache.enabled=false , cache.skipCache=true => cache should NOT be 
created
+        verifier.setAutoclean(false);
+
+        verifier.setLogFileName("../log-2.txt");
+        verifier.addCliOption("-Dmaven.build.cache.enabled=false");
+        verifier.addCliOption("-Dmaven.build.cache.skipCache=true");
+
+        verifier.executeGoal("package");
+
+        verifier.verifyErrorFreeLog();
+        verifier.verifyTextInLog("Building jar:");
+        verifyTextNotInLog(verifier, "Saved Build to local file:");
+    }
+
+    @Test
+    void enabledCacheAndSkippingCacheShouldNotCreateCache(Verifier verifier) 
throws VerificationException {
+        // cache.enabled=true , cache.skipCache= true => cache should not be 
read, only be created

Review Comment:
   The comment has a grammatical issue with inconsistent spacing: 
"cache.skipCache= true" should be "cache.skipCache=true" (missing space before 
equals sign, or add space after it for consistency).
   ```suggestion
           // cache.enabled=true , cache.skipCache=true => cache should not be 
read, only be created
   ```



-- 
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]

Reply via email to