You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/05/08 11:13:54 UTC

[maven-invoker-plugin] 01/01: [MINVOKER-279] Skipped ITs are logged as error

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MINVOKER-279
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit f1ccdabe9a712be0864dd995ebade6bd98247b37
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat May 8 13:13:30 2021 +0200

    [MINVOKER-279] Skipped ITs are logged as error
---
 .../maven/plugins/invoker/InvokerSession.java      |  2 +-
 .../maven/plugins/invoker/InvokerSessionTest.java  | 54 ++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
index 1cba4a0..ce4bc67 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
@@ -213,7 +213,7 @@ class InvokerSession
 
         logBuildJobList( logger, ignoreFailures, "The following builds failed:", failedJobs );
         logBuildJobList( logger, ignoreFailures, "The following builds finished with error:", errorJobs );
-        logBuildJobList( logger, ignoreFailures, "The following builds was skipped:", skippedJobs );
+        logBuildJobList( logger, true, "The following builds was skipped:", skippedJobs );
     }
 
     public void logFailedBuildLog( Log logger, boolean ignoreFailures )
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java
new file mode 100644
index 0000000..a8ef8a9
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerSessionTest.java
@@ -0,0 +1,54 @@
+package org.apache.maven.plugins.invoker;
+
+/*
+ * 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 static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+import java.util.Collections;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugins.invoker.model.BuildJob;
+import org.junit.Test;
+
+/**
+ * Unittest for {@link InvokerSession}
+ */
+public class InvokerSessionTest
+{
+
+    @Test
+    public void skipSummary()
+    {
+        Log logger = mock( Log.class );
+        BuildJob skippedBuildJob = new BuildJob( "minvoker-279", null );
+        skippedBuildJob.setResult( BuildJob.Result.SKIPPED );
+        InvokerSession session = new InvokerSession( Collections.singletonList( skippedBuildJob ) );
+
+        session.logSummary( logger, false );
+
+        verify( logger ).warn( "The following builds was skipped:" );
+        verify( logger ).warn( "*  minvoker-279" );
+        verify( logger, never() ).error( anyString() );
+    }
+
+}