Permalink
Browse files

bugfix for #4 "creation of test classes fails on nested maven project" (

#7)

* bugfix for #4 "creation of test classes fails on nested maven project"
* Remove the block of commented-out lines of code.
* Remove the block of commented-out lines of code.
  • Loading branch information...
fofocx authored and seratch committed Mar 30, 2017
1 parent 291c391 commit 8c307eb05f762cf8030a3bd6d903228e0d5b98b2
@@ -46,8 +46,8 @@ protected Configuration getConfiguration(IPreferenceStore store, ISelection sele
}
if (!isNotSelected(structuredSelection) && !isSelectedSeveral(structuredSelection)) {
String projectName = getProjectName(structuredSelection);
String projectRootPath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootPath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
String configFilepath = projectRootPath + "junithelper-config.properties";
File configProperites = new File(configFilepath);
if (configProperites.exists()) {
@@ -108,10 +108,6 @@ protected String getPathFromProjectRoot(StructuredSelection structuredSelection)
return ResourcePathUtil.getPathStartsFromProjectRoot(structuredSelection);
}
protected String getWorkspaceRootAbsolutePath(IWorkspaceRoot workspaceRoot) {
return workspaceRoot.getLocation().toString();
}
protected String getResourcePathForTargetClassFile(StructuredSelection structuredSelection) {
// path started from project root
String pathFromProjectRoot = getPathFromProjectRoot(structuredSelection);
@@ -102,8 +102,8 @@ public void run(IAction action) {
// get project path, resource path
projectName = getProjectName(structuredSelection);
resourcePathForTargetClassFile = getResourcePathForTargetClassFile(structuredSelection);
String projectRootAbsolutePath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootAbsolutePath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
resourcePathForTestClassFile = resourcePathForTargetClassFile.replaceFirst(
config.directoryPathOfProductSourceCode, config.directoryPathOfTestSourceCode).replace(
@@ -74,8 +74,8 @@ public void run(IAction action) {
config.directoryPathOfProductSourceCode, config.directoryPathOfTestSourceCode).replaceFirst(
"[^(Test)]\\.java$", StringValue.JUnit.TestClassNameSuffix + StringValue.FileExtension.JavaFile);
String projectName = getProjectName(structuredSelection);
String projectRootAbsolutePath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootAbsolutePath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
// ----------------------------------------
// check selection
@@ -74,8 +74,8 @@ public void run(IAction action) {
config.directoryPathOfProductSourceCode, config.directoryPathOfTestSourceCode).replaceFirst(
"[^(Test)]\\.java$", StringValue.JUnit.TestClassNameSuffix + StringValue.FileExtension.JavaFile);
String projectName = getProjectName(structuredSelection);
String projectRootAbsolutePath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootAbsolutePath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
// ----------------------------------------
// check selection
@@ -98,8 +98,8 @@ public void run(IAction action) {
StringValue.FileExtension.JavaFile,
StringValue.JUnit.TestClassNameSuffix + StringValue.FileExtension.JavaFile);
String projectRootAbsolutePath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootAbsolutePath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
String testCaseFileAbsolutePath = projectRootAbsolutePath + resourcePathForTestCaseFile;
@@ -72,8 +72,8 @@ public void run(IAction action) {
// get project path, resource path
String resourcePathForTestClassFile = getResourcePathForTargetClassFile(structuredSelection);
String projectName = getProjectName(structuredSelection);
String projectRootPath = getWorkspaceRootAbsolutePath(getIWorkspaceRoot())
+ StringValue.DirectorySeparator.General + projectName + StringValue.DirectorySeparator.General;
String projectRootPath = getIWorkspaceRoot().findMember(projectName).getLocationURI().getPath()
+ StringValue.DirectorySeparator.General;
// ----------------------------------------
// check selection

0 comments on commit 8c307eb

Please sign in to comment.