com.github.valfirst.jbehave.junit.monitoring.DescriptionTextUniquefier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbehave-junit-runner Show documentation
Show all versions of jbehave-junit-runner Show documentation
Library designed to make JBehave stories & scenarios show up in the JUnit view in IDEs supportting custom test runners
package com.github.valfirst.jbehave.junit.monitoring;
import java.util.HashSet;
import java.util.Set;
public class DescriptionTextUniquefier {
private Set uniqueDescriptions = new HashSet<>();
public String getUniqueDescription(String junitSafeString) {
String uniqueDescription = junitSafeString;
while (uniqueDescriptions.contains(uniqueDescription)) {
uniqueDescription += '\u200B'; // zero-width-space
}
uniqueDescriptions.add(uniqueDescription);
return uniqueDescription;
}
}