Permalink
Browse files

fix for StringIndexOutOfBoundsException

  • Loading branch information...
1 parent 5a9fd65 commit 745eee5f2cd534e2888e193b2943ef6a01c2fdcb @graemerocher graemerocher committed Feb 19, 2013
View
8 ...main/groovy/org/codehaus/groovy/grails/compiler/injection/test/TestForTransformation.java
@@ -150,13 +150,15 @@ public void visit(ASTNode[] astNodes, SourceUnit source) {
String fileName = source.getName();
String className = GrailsResourceUtils.getClassName(new FileSystemResource(fileName));
if (className != null) {
- boolean isSpock = className.endsWith("Spec");
String targetClassName = null;
- if (isJunit) {
+ if (className.endsWith("Tests")) {
targetClassName = className.substring(0, className.indexOf("Tests"));
}
- else if (isSpock) {
+ else if (className.endsWith("Test")) {
+ targetClassName = className.substring(0, className.indexOf("Test"));
+ }
+ else if (className.endsWith("Spec")) {
targetClassName = className.substring(0, className.indexOf("Spec"));
}

0 comments on commit 745eee5

Please sign in to comment.