diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-20 14:45:51 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2021-03-20 14:45:51 +0700 |
commit | 2a2f4e20b413c12a634bb6c3732da4da598bad96 (patch) | |
tree | 0aa17e9aed391414d51b13f065975b4d0b4cd5af /testing-client/src/test | |
parent | 0b866816fa45166c8b32859ba4090504d5b1da56 (diff) | |
download | aspectj-2a2f4e20b413c12a634bb6c3732da4da598bad96.tar.gz aspectj-2a2f4e20b413c12a634bb6c3732da4da598bad96.zip |
Fix tests not finding project base directory 'org.aspectj'
Several LTW tests using class TestServer failed on my machine because
there was a hard-coded project base directory name 'org.aspectj' in the
class. This class has several other problems, but my quick fix for now -
I did not want to rename my project base directory - was to match on a
regex '(?i)(org[.])?aspectj' now. That also works for my root directory
'AspectJ'.
I also moved the code determining the project dir into a protected
(hence testable) method and added a sanity test case checking if the
directory can be determined. If not, the test will fail with a rather
lengthy warning to developers about the need to have a matching project
root folder.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'testing-client/src/test')
-rw-r--r-- | testing-client/src/test/java/org/aspectj/testing/server/TestServerTest.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing-client/src/test/java/org/aspectj/testing/server/TestServerTest.java b/testing-client/src/test/java/org/aspectj/testing/server/TestServerTest.java index 0c278588e..0f40d3a03 100644 --- a/testing-client/src/test/java/org/aspectj/testing/server/TestServerTest.java +++ b/testing-client/src/test/java/org/aspectj/testing/server/TestServerTest.java @@ -14,6 +14,8 @@ import java.io.IOException; import junit.framework.TestCase; +import static org.aspectj.testing.server.TestServer.REGEX_PROJECT_ROOT_FOLDER; + public class TestServerTest extends TestCase { private TestServer server; @@ -34,6 +36,17 @@ public class TestServerTest extends TestCase { } } + public void testFindProjectRootDirectory() throws IOException { + // Give developers some advice in the build log about why their LTW tests fail + assertNotNull( + "Cannot find AspectJ project root folder. " + + "This will lead to subsequent failures in all tests using class TestServer. " + + "Please make sure to name your project root folder 'org.aspectj', 'AspectJ' or " + + "something else matching regex '"+ REGEX_PROJECT_ROOT_FOLDER+"'.", + server.findProjectRootFolder() + ); + } + public void testSetWorkingDirectory() { server.setWorkingDirectory("../testing-client/testdata"); } |