All Downloads are FREE. Search and download functionalities are using the official Maven repository.

generator.server.javatool.base.test.ReplaceCamelCase.mustache Maven / Gradle / Ivy

There is a newer version: 1.18.1
Show newest version
package {{packageName}};

import java.lang.reflect.Method;
import org.junit.jupiter.api.DisplayNameGenerator;

public class ReplaceCamelCase extends DisplayNameGenerator.Standard {

  @Override
  public String generateDisplayNameForMethod(Class testClass, Method testMethod) {
    return this.replaceCapitals(testMethod.getName());
  }

  private String replaceCapitals(String name) {
    name = name.replaceAll("([A-Z])", " $1");
    name = name.replaceAll("(\\d+)", " $1");
    name = name.toLowerCase();
    return name;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy