diff --git a/src/main/groovy/org/owasp/dependencycheck/gradle/tasks/AbstractAnalyze.groovy b/src/main/groovy/org/owasp/dependencycheck/gradle/tasks/AbstractAnalyze.groovy
index 15bb170..ea6fb35 100644
--- a/src/main/groovy/org/owasp/dependencycheck/gradle/tasks/AbstractAnalyze.groovy
+++ b/src/main/groovy/org/owasp/dependencycheck/gradle/tasks/AbstractAnalyze.groovy
@@ -377,18 +377,15 @@ abstract class AbstractAnalyze extends ConfiguredTask {
* Checks whether a configuration is considered to be a test configuration in order to skip it.
* A configuration is considered a test configuration if and only if any of the following conditions holds:
*
- * - the name of the configuration or any of its parent configurations equals 'testCompile'
- * - the name of the configuration or any of its parent configurations equals 'testImplementation'
- * - the name of the configuration or any of its parent configurations equals 'androidTestCompile'
- * - the configuration name starts with 'test'
- * - the configuration name starts with 'androidTest'
+ * - the name of the configuration or any of its parent configurations matches /((^|[a-z0-9_])T|(^|_)t)est([A-Z0-9_]|$)/
*
+ * The intent of the regular expression is to match `test` in a camel case or snake case configuration name.
*/
@groovy.transform.CompileStatic
static boolean isTestConfigurationCheck(Configuration configuration) {
- boolean isTestConfiguration = configuration.name.startsWith("test") || configuration.name.startsWith("androidTest")
+ boolean isTestConfiguration = configuration.name =~ /((^|[a-z0-9_])T|(^|_)t)est([A-Z0-9_]|$)/
configuration.hierarchy.each {
- isTestConfiguration |= (it.name == "testCompile" || it.name == "androidTestCompile" || it.name == "testImplementation")
+ isTestConfiguration |= it.name ==~ /((^|[a-z0-9_])T|(^|_)t)est([A-Z0-9_]|$)/
}
isTestConfiguration
}