You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "TheRealHaui (via GitHub)" <gi...@apache.org> on 2025/12/01 16:33:23 UTC
[PR] Add tests [maven]
TheRealHaui opened a new pull request, #11509:
URL: https://github.com/apache/maven/pull/11509
Added new Unit Tests
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2592513087
##########
impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeBuilderTest.java:
##########
@@ -44,6 +46,10 @@ public int read(char[] cbuf, int off, int len) throws IOException {
XmlNode node1 = XmlService.read(r);
XmlNode node2 = XmlService.read(r);
assertEquals(node1, node2);
+
+ node1 = XmlService.read(new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8)), null);
Review Comment:
don't reuse local variables. New variables or better yet a completely new test method.
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
could just initialize the fields
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2593591410
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
Which then would lead every test method having
private Plugin pluginOne = new Plugin();
private Plugin pluginTwo = new Plugin();
at the beginning repeatedly.
Don't you think that using the /@BeforeEach approach is better?
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on PR #11509:
URL: https://github.com/apache/maven/pull/11509#issuecomment-3608812767
@TheRealHaui You need to run mvn spotless:apply to correctly format the source code.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2593626318
##########
impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeBuilderTest.java:
##########
@@ -44,6 +46,10 @@ public int read(char[] cbuf, int off, int len) throws IOException {
XmlNode node1 = XmlService.read(r);
XmlNode node2 = XmlService.read(r);
assertEquals(node1, node2);
+
+ node1 = XmlService.read(new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8)), null);
Review Comment:
The re-use of the variables is in no whatsoever way hidden/not visible in the code.
Therefore, I think this can be considered to not lead to any problems on developers sides because it gets overseen by them.
And as it is common in program code that variables get re-used/assigned new values I see no whatsoever problem actually to be honest.
Nonetheless, changed the code and pushed the change.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2593591410
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
Which then would lead every test method having
private Plugin pluginOne = new Plugin();
private Plugin pluginTwo = new Plugin();
at the beginning repeatedly.
Don't you think that using the \@BeforeEach approach is better?
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2593907800
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
No, that is not how JUnit works. Just initialize the fields. A new test object is used for every test.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2595093043
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
I knew of course because of the way JUnit works that it specifically instantiates objects.
However, wasn't aware of that - test adapted and pushed.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2593591410
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne;
+ private Plugin pluginTwo;
+
+ @BeforeEach
Review Comment:
Which then would lead every test method having
private Plugin pluginOne = new Plugin();
private Plugin pluginTwo = new Plugin();
at the beginning repeatedly.
Don't you think that using the (at)BeforeEach approach is better?
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "TheRealHaui (via GitHub)" <gi...@apache.org>.
TheRealHaui commented on PR #11509:
URL: https://github.com/apache/maven/pull/11509#issuecomment-3613128075
@gnodet,
I know ... or better actually I thought I know or whatever ...
Thought I did it.
However, NOW I really did it.
Thanks for the hint!
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r2596302840
##########
impl/maven-xml/src/test/java/org/apache/maven/internal/xml/XmlNodeBuilderTest.java:
##########
@@ -44,6 +46,10 @@ public int read(char[] cbuf, int off, int len) throws IOException {
XmlNode node1 = XmlService.read(r);
XmlNode node2 = XmlService.read(r);
assertEquals(node1, node2);
+
Review Comment:
This should be a separate test method
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "slachiewicz (via GitHub)" <gi...@apache.org>.
slachiewicz commented on PR #11509:
URL: https://github.com/apache/maven/pull/11509#issuecomment-5399291578
The last CI run on this branch was 2025-12-07, and GitHub has deleted the logs since, so there's no way to tell whether the change still builds against master.
A rebase triggers a fresh run and makes the state readable again. If you'd rather not carry it forward, closing is equally useful — the PR isn't being ignored, it's unreadable.
*This comment was created with AI assistance.*
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet commented on code in PR #11509:
URL: https://github.com/apache/maven/pull/11509#discussion_r3369563647
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne = new Plugin();
+ private Plugin pluginTwo = new Plugin();
+
+ @Test
+ void testPluginEqualsEmptyPlugins() {
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetArtifactId() {
+ pluginOne.setArtifactId("myArtifact");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setArtifactId("myArtifact");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetGroupId() {
+ pluginOne.setGroupId("myGroupId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setGroupId("myGroupId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetVersion() {
+ pluginOne.setVersion("myVersion");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setVersion("myVersion");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetExtension() {
+ pluginOne.setExtensions("true");
+
Review Comment:
The test sets `pluginTwo.setExtensions("TRUE")` but never asserts anything after it. Since `isExtensions()` delegates to `Boolean.parseBoolean()` which is case-insensitive, both plugins should now have `isExtensions() == true` and `pluginEquals` should return `true`. Please add the missing assertion:
```suggestion
pluginTwo.setExtensions("TRUE");
assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
```
##########
impl/maven-core/src/test/java/org/apache/maven/plugin/CacheUtilsTest.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.plugin;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Plugin;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class CacheUtilsTest {
+
+ private Plugin pluginOne = new Plugin();
+ private Plugin pluginTwo = new Plugin();
+
+ @Test
+ void testPluginEqualsEmptyPlugins() {
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetArtifactId() {
+ pluginOne.setArtifactId("myArtifact");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setArtifactId("myArtifact");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetGroupId() {
+ pluginOne.setGroupId("myGroupId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setGroupId("myGroupId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetVersion() {
+ pluginOne.setVersion("myVersion");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setVersion("myVersion");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+ }
+
+ @Test
+ void testPluginEqualsSetExtension() {
+ pluginOne.setExtensions("true");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ pluginTwo.setExtensions("TRUE");
+ }
+
+ @Test
+ void testPluginEqualsSetDependency() {
+ Dependency dependencyOne = new Dependency();
+ pluginOne.addDependency(dependencyOne);
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ Dependency dependencyTwo = new Dependency();
+ pluginTwo.addDependency(dependencyTwo);
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ dependencyTwo.setGroupId("myDependencyGroupId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ dependencyOne.setGroupId("myDependencyGroupId");
+ dependencyTwo.setArtifactId("myDependencyArtifactId");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ dependencyTwo.setVersion("myDependencyVersion");
+
+ assertTrue(CacheUtils.pluginEquals(pluginOne, pluginOne));
+ assertFalse(CacheUtils.pluginEquals(pluginOne, pluginTwo));
+
+ dependencyOne.setArtifactId("myDependencyArtifactId");
Review Comment:
Line 115 (`dependencyTwo.setVersion("myDependencyVersion")`) is redundant -- this was already set on line 110. It looks like the intended line was `dependencyOne.setVersion("myDependencyVersion")` to bring both dependencies back to equality, followed by a `assertTrue` to verify convergence. As written, the test never verifies that two dependencies with identical fields are considered equal (after the initial empty-dependency case).
Also consider testing the remaining fields compared by `dependenciesEquals()`: `type`, `classifier`, `scope`, and `exclusions`.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add tests [maven]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11509:
URL: https://github.com/apache/maven/pull/11509#issuecomment-6379419459
This pull request is stale because it has been waiting for feedback for 60 days. Remove the stale label or comment on this PR, or it will be automatically closed in 30 days.
--
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: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org