Here you can find the source of sanitizeSuiteName(String name)
Parameter | Description |
---|---|
name | The name to sanitize. In most cases this is the class name of the test being run, but some frameworks (I'm looking at you, Cucumber) like to pass weird things like human-readable free-form textual descriptions of the tests, so we can't make assumptions. |
static String sanitizeSuiteName(String name)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (see LICENSE). public class Main { /**/*from ww w. j a va 2s . co m*/ * Returns a sanitized suite name suitable for inclusion in a XML report. * * This is also used to generate an XML report's filename, so it is important that it does not * contain special characters that are illegal on the filesystem. * * This strips out punction and whitespace, but leaves the '_', '.', and '-' symbols, and trailing * periods are trimmed. * * @param name The name to sanitize. In most cases this is the class name of the test being run, * but some frameworks (I'm looking at you, Cucumber) like to pass weird things like * human-readable free-form textual descriptions of the tests, so we can't make assumptions. * @return */ static String sanitizeSuiteName(String name) { return name.replaceAll("[[\\p{Punct}][\\p{Space}]&&[^_.-]]", "-").replaceAll("[.]+$", ""); } }