You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/01/24 18:07:02 UTC

[GitHub] [maven-surefire] slawekjaranowski opened a new pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

slawekjaranowski opened a new pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445


   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SUREFIRE) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[SUREFIRE-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `SUREFIRE-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean install` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [x] You have run the integration tests successfully (`mvn -Prun-its clean install`).
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   


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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793364036



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );

Review comment:
       It would be great to have unit tests for `JUnitPlatformProviderInfo` because the method `getProviderClasspath()` is not covered by unit tests, only covered by ITs. The [documentation](https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html) describes the behavior and the provider classpath is always resolved to necessary libraries including API and junit5 impl libraries.




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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793785995



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       code assume that input artifacts is correct .. for me looks like mixed responsibility 
   `ProviderInfo` should take as input whole classpath of project and take decision on it in one place.
   
   Now we search artifacts in separate methods in `AbstractSurefireMojo` and pass only result to `ProviderInfo` ...
   in `AbstractSurefireMojo` should not be any separate logic for it.
   
   But it is another case and place to improvement.




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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793370011



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       If the version is checked, why the groupdId and artifactId is not checked? The caller is checking it?




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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793549923



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       I am talking about different things:
   Why only `version` is checked? Why the groupId and artifactId are not checked in the impl?
   Your artifact is `test:test:4.5` in this test. A whatever artifact coordinates `*:*:4.5` would pass this test. Do you know what I mean?




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



[GitHub] [maven-surefire] Tibor17 edited a comment on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 edited a comment on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1021454917


   If you read the name of method like a news `autoDetectOneWellKnownProvider()` it says that one should be detected.
   We use to return `List<ProviderInfo>`. I know why it is. It simplifies the caller but it is not alright. If we have returned `Optional<ProviderInfo>` the method would be called easily `.map(singletonList()).orElse(emptyList())` with Java 8.


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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793372465



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit47AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.7" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        // ??? it is ok for 4.7 ???

Review comment:
       This is ok, it is suitable provider info also for the 4.7+ if you did not configure parallel/groups.
   But I see that you have missed the `JUnitCoreProviderInfo` - it is for 4.7+ and parallel/groups.




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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793537138



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       current state - it is done in this way




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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793772469



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );

Review comment:
       https://issues.apache.org/jira/browse/SUREFIRE-1991




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



[GitHub] [maven-surefire] Tibor17 commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1021442604


   The call `new TestNgProviderInfo( null ).isApplicable()` returns `false`.
   We call `new DynamicProviderInfo( null ).isApplicable()` but it returns `true`.
   The impl in `DynamicProviderInfo` should be a bit more similar to other impl of ProviderInfo and it should not only return the same value without the null check at least.


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



[GitHub] [maven-surefire] Tibor17 commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1021479840


   @slawekjaranowski
   Your tests have discovered these cosmetic issues, so yes, pls open new tickets.


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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793551203



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       The point of writing the tests is that my eyes stay blind, I should not see the implementation...




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



[GitHub] [maven-surefire] slawekjaranowski commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1073310665


   @Tibor17 - ping


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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793540328



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       current state ... 
   test for only `JUnit4ProviderInfo` not caller




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



[GitHub] [maven-surefire] slawekjaranowski commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1021478705


   changes for `DynamicProviderInfo` implementation should be done in separate PR with new issue.
   
   also changing  for `autoDetectOneWellKnownProvider` method is out of scope for this PR.


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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793542420



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit47AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.7" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        // ??? it is ok for 4.7 ???

Review comment:
       There is separate test for it `AbstractSurefireMojoJunitCoreProvidersInfoTest`




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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793549923



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       I am talking about different things:
   Why only `version` is checked? Why the groupId and artifactId are not checked in the impl?
   You artifact is `test:test:4.5`. Whatever `*:*:4.5` would pass this test. Do you know what I mean?




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



[GitHub] [maven-surefire] slawekjaranowski commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1049568419


   @Tibor17 Do we want to merge it? I need rebase it.


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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793536350



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );

Review comment:
       it should be done is separate PR - many cases for ``getProviderClasspath`




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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r794479343



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       The purpose of writing the uni tests is hiding your eyes and you should write the tests without knowing the implementation, even before the impl exists. Here the impl exists, therefore we should hide our eyes. Then new issues would rise up.




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



[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793778831



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       I don't know why only version is checked, probably is assumptions that input is correct ... artifact is provided by method `getJunitArtifact` which search specific groupId and artifactId




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



[GitHub] [maven-surefire] Tibor17 commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1021454917


   If you read the name of method like a news `autoDetectOneWellKnownProvider()` it says that one should be detected.
   We use to return `List<ProviderInfo>`. I know why it is. It simplifies the caller but it is not alright. If we have returned `Optional<ProviderInfo>` the would be called easily `.map(singletonList()).orElse(emptyList())` with Java 8.


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



[GitHub] [maven-surefire] slawekjaranowski commented on pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#issuecomment-1022562681


   issues created and linked


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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793368636



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       It looks like the caller's logic guarantees that the artifact coordinates are `junit:junit-dep` and `JUnit4ProviderInfo` makes only the null check. hm...




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



[GitHub] [maven-surefire] Tibor17 commented on a change in pull request #445: [SUREFIRE-1962] Unit test for ProviderInfo#isApplicable

Posted by GitBox <gi...@apache.org>.
Tibor17 commented on a change in pull request #445:
URL: https://github.com/apache/maven-surefire/pull/445#discussion_r793549923



##########
File path: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoProvidersInfoTest.java
##########
@@ -0,0 +1,172 @@
+package org.apache.maven.plugin.surefire;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.surefire.providerapi.ProviderInfo;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+
+/**
+ * Testing providerInfo applicable behavior.
+ */
+@RunWith( MockitoJUnitRunner.class )
+public class AbstractSurefireMojoProvidersInfoTest
+{
+
+    @Spy
+    private AbstractSurefireMojo mojo;
+
+    @Test
+    public void defaultProviderAreAlwaysAvailable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit3ProviderInfo();
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void dynamicProviderAreAlwaysApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new DynamicProviderInfo( "test" );
+        assertThat( providerInfo.isApplicable() ).isTrue();
+    }
+
+    @Test
+    public void testNgProviderApplicable()
+    {
+        Artifact testNg = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( testNg );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( testNg );
+    }
+
+    @Test
+    public void testNgProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new TestNgProviderInfo( null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    //surefire-junit-platform
+
+    @Test
+    public void jUnitPlatformProviderApplicable()
+    {
+        Artifact junitPlatform = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( junitPlatform, aTestClassPath() );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitPlatform );
+    }
+
+    @Test
+    public void jUnitPlatformProviderNotApplicable()
+    {
+        ProviderInfo providerInfo = mojo.new JUnitPlatformProviderInfo( null, aTestClassPath() );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    // surefire-junit4
+
+    @Test
+    public void jUnit4ProviderNullArtifacts()
+    {
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderOnlyJunitDepArtifact()
+    {
+        Artifact junitDep = mock( Artifact.class );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( null, junitDep );
+
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+
+    @Test
+    public void jUnit4ProviderJunit3WithJDepArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        Artifact junitDep = mock( Artifact.class );
+
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, junitDep );
+
+        // ??? only existing for junitDep in any version is checked
+        assertThat( providerInfo.isApplicable() ).isTrue();
+
+        // no interaction with artifact only reference are checked
+        verifyNoMoreInteractions( junitDep );
+    }
+
+    @Test
+    public void jUnit4ProviderJunit3AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "3.8.1" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isFalse();
+    }
+
+    @Test
+    public void jUnit4ProviderJunit45AsDependencyArtifact()
+    {
+        Artifact junit = aArtifact( "4.5" );
+        ProviderInfo providerInfo = mojo.new JUnit4ProviderInfo( junit, null );
+        assertThat( providerInfo.isApplicable() ).isTrue();

Review comment:
       I am talking about different things:
   Why only `version` is checked? Why the groupId and artifactId are not checked in the impl?
   Your artifact is `test:test:4.5` in this test. Whatever `*:*:4.5` would pass this test. Do you know what I mean?




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