String (final @NotNull SMTestProxy testProxy, final @Nullable String name) { if (name == null) { return Holder.getNoNameTest(); } final SMTestProxy parent = testProxy.getParent(); String presentationCandidate = name; if (parent != null && !testProxy.isSuite()) { String parentName = parent.getName(); if (parentName != null) { boolean parentStartsWith = name.startsWith(parentName); if (!parentStartsWith && parent instanceof SMTestProxy.SMRootTestProxy) { final String presentation = ((SMTestProxy.SMRootTestProxy)parent).getPresentation(); if (presentation != null) { parentName = presentation; parentStartsWith = name.startsWith(parentName); if (!parentStartsWith) { String comment = ((SMTestProxy.SMRootTestProxy)parent).getComment(); if (comment != null) { parentName = StringUtil.getQualifiedName(comment, presentation); parentStartsWith = name.startsWith(parentName); } } } } if (parentStartsWith) { presentationCandidate = name.substring(parentName.length()); // remove "." separator presentationCandidate = StringUtil.trimStart(presentationCandidate, "."); } } } // trim presentationCandidate = presentationCandidate.trim(); // remove extra spaces presentationCandidate = presentationCandidate.replaceAll("\\s+", " "); if (StringUtil.isEmpty(presentationCandidate)) { return Holder.getNoNameTest(); } return presentationCandidate; }