diff options
author | mkersten <mkersten> | 2003-07-22 16:32:52 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-07-22 16:32:52 +0000 |
commit | b5e148fd6046e283b1c7c9f67e18fa0d6bc33f6e (patch) | |
tree | 6e4c41070106c467f6b90f9d70a31e983de356d1 /ajde | |
parent | b36560b79b17199ce35c09e548396b34694a97a9 (diff) | |
download | aspectj-b5e148fd6046e283b1c7c9f67e18fa0d6bc33f6e.tar.gz aspectj-b5e148fd6046e283b1c7c9f67e18fa0d6bc33f6e.zip |
Added coverge to LST file tests. Improved name of file opening method.
Diffstat (limited to 'ajde')
6 files changed, 40 insertions, 16 deletions
diff --git a/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java b/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java index 7e21a6939..d0179dac3 100644 --- a/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java +++ b/ajde/testsrc/org/aspectj/ajde/AjdeTestCase.java @@ -29,7 +29,7 @@ public class AjdeTestCase extends TestCase { super(name); } - protected File createFile(String path) { + protected File openFile(String path) { return new File(currTestDataPath + File.separatorChar + path); } @@ -38,7 +38,7 @@ public class AjdeTestCase extends TestCase { */ protected void doSynchronousBuild(String configFilePath) { testerBuildListener.reset(); - File configFile = createFile(configFilePath); + File configFile = openFile(configFilePath); Ajde.getDefault().getBuildManager().build(configFile.getAbsolutePath()); while(!testerBuildListener.getBuildFinished()) { try { diff --git a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java index 35e1f46cf..178d92efe 100644 --- a/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java +++ b/ajde/testsrc/org/aspectj/ajde/CompilerMessagesTest.java @@ -13,6 +13,7 @@ package org.aspectj.ajde; import java.io.IOException; +import java.util.Iterator; import java.util.List; /** @@ -38,13 +39,13 @@ public class CompilerMessagesTest extends AjdeTestCase { // The build has happened, what messages did the compiler give, and do they // contain the information we expect? List msgs = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); - if (1 != msgs.size()) { - assertTrue("not one message: " + msgs, false); + if (2 != msgs.size()) { + assertTrue("not two messages: " + msgs, false); } - assertEquals("One warning message should be produced",1,msgs.size()); + assertEquals("Two warning messages should be produced",2,msgs.size()); NullIdeTaskListManager.SourceLineTask task = (NullIdeTaskListManager.SourceLineTask) msgs.get(0); - assertEquals( 6, task.location.getLine()); + assertEquals( 8, task.location.getLine()); assertEquals( "Please don't call init methods", task.message); try { String fullyQualifiedFile = task.location.getSourceFile().getCanonicalPath(); @@ -58,6 +59,14 @@ public class CompilerMessagesTest extends AjdeTestCase { } } + + public void testDeclareMessageContents() { + List msgs = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); + assertEquals( "Please don't call setters" , ((NullIdeTaskListManager.SourceLineTask) msgs.get(1)).message); + + } + + /* * @see TestCase#setUp() */ diff --git a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java index 23cfe4ffa..d11a5a611 100644 --- a/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java +++ b/ajde/testsrc/org/aspectj/ajde/StructureModelTest.java @@ -81,7 +81,7 @@ public class StructureModelTest extends AjdeTestCase { public void testRootForSourceFile() throws IOException { - File testFile = createFile("figures-coverage/figures/Figure.java"); + File testFile = openFile("figures-coverage/figures/Figure.java"); StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findRootNodeForSourceFile( testFile.getCanonicalPath()); assertTrue("find result", node != null) ; @@ -91,7 +91,7 @@ public class StructureModelTest extends AjdeTestCase { } public void testPointcutName() throws IOException { - File testFile = createFile("figures-coverage/figures/Main.java"); + File testFile = openFile("figures-coverage/figures/Main.java"); //System.err.println("PointcutName, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists()); StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findRootNodeForSourceFile( testFile.getCanonicalPath()); @@ -105,7 +105,7 @@ public class StructureModelTest extends AjdeTestCase { } public void testFileNodeFind() throws IOException { - File testFile = createFile("figures-coverage/figures/Main.java"); + File testFile = openFile("figures-coverage/figures/Main.java"); //System.err.println("NodeFind, testFile: " + testFile.getCanonicalPath() + " exists: " + testFile.exists()); StructureNode node = Ajde.getDefault().getStructureModelManager().getStructureModel().findNodeForSourceLine( testFile.getCanonicalPath(), 1); @@ -123,7 +123,7 @@ public class StructureModelTest extends AjdeTestCase { StructureModel model = Ajde.getDefault().getStructureModelManager().getStructureModel(); assertTrue("model exists", model != null); assertTrue("root exists", model.getRoot() != null); - File testFile = createFile("figures-coverage/figures/Main.java"); + File testFile = openFile("figures-coverage/figures/Main.java"); StructureNode node = model.findNodeForSourceLine(testFile.getCanonicalPath(), 11); assertTrue("find result", node != null); diff --git a/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java index c69364d85..144a2fb56 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/AspectJBuildManagerTest.java @@ -61,7 +61,7 @@ public class AspectJBuildManagerTest extends AjdeTestCase { } public void testSymbolFileGenerated() { - File file = createFile("../examples/figures-coverage/all.ajsym"); + File file = openFile("../examples/figures-coverage/all.ajsym"); if (file.exists()) { file.delete(); } else { diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java index 5d9f78af8..75c4748c3 100644 --- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java @@ -15,12 +15,16 @@ package org.aspectj.ajde.internal; import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; import junit.framework.TestSuite; import org.aspectj.ajde.AjdeTestCase; import org.aspectj.ajde.BuildConfigManager; +import org.aspectj.ajde.NullIdeManager; +import org.aspectj.ajde.NullIdeTaskListManager.SourceLineTask; import org.aspectj.ajde.ui.BuildConfigModel; import org.aspectj.ajde.ui.internal.AjcBuildOptions; @@ -44,8 +48,19 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { return result; } + public void testErrorMessages() throws IOException { + doSynchronousBuild("invalid-entry.lst"); + assertTrue("compile failed", !testerBuildListener.getBuildSucceeded()); + + List messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks(); + SourceLineTask message = (SourceLineTask)messages.get(0); + + System.err.println(">>>> " + message.message); + assertEquals("invalid option: aaa.bbb", message.message); + } + public void testNonExistentConfigFile() throws IOException { - File file = createFile("mumbleDoesNotExist.lst"); + File file = openFile("mumbleDoesNotExist.lst"); assertTrue("valid non-existing file", !file.exists()); BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath()); System.err.println(model.getRoot().getChildren()); @@ -53,7 +68,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase { } public void testFileRelativePathSameDir() throws IOException { - File file = createFile("file-relPath-sameDir.lst"); + File file = openFile("file-relPath-sameDir.lst"); System.err.println("> " + file.getCanonicalPath()); BuildConfigModel model = buildConfigManager.buildModel(file.getCanonicalPath()); System.err.println("> " + model.getRoot()); diff --git a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java index a5fcf71d1..2e0e7da39 100644 --- a/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java +++ b/ajde/testsrc/org/aspectj/ajde/ui/StructureViewManagerTest.java @@ -76,7 +76,7 @@ public class StructureViewManagerTest extends AjdeTestCase { public void testFreshStructureModelCreation() { renderer.setHasBeenNotified(false); String modelPath = genStructureModelExternFilePath(CONFIG_FILE_PATH); - createFile(modelPath).delete(); + openFile(modelPath).delete(); //System.err.println("> path: " + modelPath); Ajde.getDefault().getStructureModelManager().readStructureModel(CONFIG_FILE_PATH); @@ -136,7 +136,7 @@ public class StructureViewManagerTest extends AjdeTestCase { doSynchronousBuild(CONFIG_FILE_PATH); properties = Ajde.getDefault().getStructureViewManager().getDefaultViewProperties(); - testFile = createFile("../examples/figures-coverage/figures/Figure.java"); + testFile = openFile("../examples/figures-coverage/figures/Figure.java"); currentView = Ajde.getDefault().getStructureViewManager().createViewForSourceFile(testFile.getAbsolutePath(), properties); currentView.setRenderer(renderer); } |