From b0b9b68419808ef90dc6b31d051e6d859f3651c1 Mon Sep 17 00:00:00 2001 From: wisberg Date: Wed, 30 Apr 2003 02:40:17 +0000 Subject: [PATCH] mainly changed setup to avoid reading any existing user properties, which was causing build configuration tests to fail now that all options are significant --- .../aspectj/ajde/BuildConfigurationTests.java | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java index 4c00ebf2a..c797b0489 100644 --- a/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java +++ b/ajde/testsrc/org/aspectj/ajde/BuildConfigurationTests.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import junit.framework.AssertionFailedError; import junit.framework.TestSuite; /** @@ -432,7 +433,7 @@ public class BuildConfigurationTests extends AjdeTestCase { public void testAspectPath() { Set aspects = new HashSet(); projectProperties.setAspectPath( aspects ); - buildConfig = compilerAdapter.genBuildConfig( configFile ); + buildConfig = compilerAdapter.genBuildConfig( configFile ); List aPath = buildConfig.getAspectpath(); assertTrue( "no aspect path", aPath.isEmpty() ); @@ -440,7 +441,7 @@ public class BuildConfigurationTests extends AjdeTestCase { aspects.add( f ); buildConfig = compilerAdapter.genBuildConfig( configFile ); List aPath2 = buildConfig.getAspectpath(); - assertTrue( "one jar in path", aPath2.size() == 1 ); + assertEquals("aspectpath", 1, aPath2.size()); assertTrue( "1 aspectpath", aPath2.contains(f) ); @@ -457,43 +458,44 @@ public class BuildConfigurationTests extends AjdeTestCase { String outJar = "mybuild.jar"; projectProperties.setOutJar( outJar ); buildConfig = compilerAdapter.genBuildConfig( configFile ); - assertEquals( "out jar", outJar, buildConfig.getOutputJar().toString() ); + assertNotNull("output jar", buildConfig.getOutputJar()); + assertEquals( "out jar", outJar, buildConfig.getOutputJar().toString() ); } protected void setUp() throws Exception { - preferencesAdapter = new UserPreferencesStore(); + preferencesAdapter = new UserPreferencesStore(false); buildOptions = new AjcBuildOptions(preferencesAdapter); compilerAdapter = new CompilerAdapter(); projectProperties = new NullIdeProperties( "" ); - init(); + + try { + String s = null; + Ajde.init( + null, + null, + null, + projectProperties, + buildOptions, + null, + null, + null); + + //Ajde.getDefault().enableLogging( System.out ); + } catch (Throwable t) { + AssertionFailedError e = new AssertionFailedError(); + e.initCause(t); + throw e; + } } - protected void tearDown() throws Exception { + protected void tearDown() throws Exception { super.tearDown(); - buildOptions.setCharacterEncoding(""); + preferencesAdapter = null; + buildOptions = null; + compilerAdapter = null; + projectProperties = null; } - public void init() { - try { - Ajde.init( - null, - null, - null, - projectProperties, - buildOptions, - null, - null, - null); - - //Ajde.getDefault().enableLogging( System.out ); - } catch (Throwable t) { - t.printStackTrace(); - Ajde.getDefault().getErrorHandler().handleError( - "Ajde failed to initialize.", - t); - } - } - private void assertOptionEquals( String reason, Map options, String optionName, String value) { String mapValue = (String) options.get(optionName); assertEquals( reason, value, mapValue ); -- 2.39.5