Added Documentation generating test to be used in the manual

This commit is contained in:
Michael Hunger
2011-10-06 14:12:44 +02:00
parent e889fd59eb
commit fbdb667858
4 changed files with 75 additions and 1 deletions

View File

@@ -1,3 +1,18 @@
/**
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.neo4j.annotation;
import java.lang.annotation.ElementType;

View File

@@ -1,3 +1,18 @@
/**
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test;
@@ -85,11 +100,25 @@ public abstract class DocumentingTestBase {
protected File getJavaFile() {
final String javaFileName = getClass().getName().replaceAll("\\.", File.separator) + ".java";
final File javaFile = new File(module() + "/src/test/java", javaFileName);
final File javaFile = new File(directoryPrefix() + "src/test/java", javaFileName);
if (!javaFile.exists()) fail("Snippet File " + javaFile + " does not exist ");
return javaFile;
}
private String directoryPrefix() {
final boolean isAlreadyInDirectory = moduleWithParent().equals(currentDirectoryWithParent());
return isAlreadyInDirectory ? "" : module()+"/";
}
private String moduleWithParent() {
return ("spring-data-neo4j/"+module());
}
private String currentDirectoryWithParent() {
final File currentDir = new File(".").getAbsoluteFile();
return currentDir.getParentFile().getParentFile().getName() + "/" + currentDir.getParentFile().getName();
}
protected String module() {
return "spring-data-neo4j";
}

View File

@@ -1,3 +1,18 @@
/**
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test;
import org.junit.Test;

View File

@@ -1,3 +1,18 @@
/**
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.snippets;
import org.junit.Test;