You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ir...@apache.org on 2020/06/03 18:02:28 UTC

[ignite-teamcity-bot] branch master updated: Added regex for test class and method name (#163)

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

irakov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d6da9d  Added regex for test class and method name (#163)
6d6da9d is described below

commit 6d6da9d12ef15a28136110b4866a96b2a27fd6ce
Author: sergeyuttsel <ut...@gmail.com>
AuthorDate: Wed Jun 3 21:02:19 2020 +0300

    Added regex for test class and method name (#163)
    
    Signed-off-by: Ivan Rakov <iv...@gmail.com>
---
 .../apache/ignite/tcbot/engine/ui/ShortTestFailureUi.java    | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortTestFailureUi.java b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortTestFailureUi.java
index 92a2319..a1a8560 100644
--- a/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortTestFailureUi.java
+++ b/tcbot-engine/src/main/java/org/apache/ignite/tcbot/engine/ui/ShortTestFailureUi.java
@@ -17,6 +17,8 @@
 package org.apache.ignite.tcbot.engine.ui;
 
 import com.google.common.base.Strings;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.apache.ignite.tcbot.engine.chain.TestCompactedMult;
@@ -24,6 +26,8 @@ import org.apache.ignite.tcignited.ITeamcityIgnited;
 import org.apache.ignite.tcignited.history.IRunHistory;
 
 public class ShortTestFailureUi {
+    private static final Pattern TEST_CLASS_AND_METHOD_PATTERN = Pattern.compile("([^.]+[.][^.]+(\\[.+\\])?$)");
+
     /** Test full Name */
     public String name;
 
@@ -62,13 +66,11 @@ public class ShortTestFailureUi {
 
     public static String extractTest(String s) {
         String testShort = s.trim();
-        String[] testComps = testShort.split("\\.");
-        if (testComps.length > 2)
-            return testComps[testComps.length - 2] + "." + testComps[testComps.length - 1];
-        return null;
+        Matcher matcher = TEST_CLASS_AND_METHOD_PATTERN.matcher(testShort);
+        return matcher.find() ? matcher.group(0) : null;
     }
 
-    public static   String extractSuite(String s) {
+    public static String extractSuite(String s) {
         String suiteShort = s.trim();
         String[] suiteComps = suiteShort.split("\\.");
         if (suiteComps.length > 1)