Add tests for new methods

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@570891 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Carlos Sanchez Gonzalez 2007-08-29 18:31:11 +00:00
parent 32f2fce4ee
commit 4f6f890697
1 changed files with 19 additions and 4 deletions

View File

@ -20,6 +20,7 @@ package org.apache.maven.embedder;
*/ */
import org.codehaus.plexus.PlexusTestCase; import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import java.io.File; import java.io.File;
@ -37,8 +38,11 @@ public class ValidateConfigurationTest
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration ); ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isUserSettingsFilePresent() ); assertTrue( result.isUserSettingsFilePresent() );
assertTrue( result.isUserSettingsFileParses() ); assertTrue( result.isUserSettingsFileParses() );
assertNotNull( result.getUserSettings() );
assertNull( result.getUserSettingsException() );
assertNull( result.getGlobalSettings() );
assertNull( result.getGlobalSettingsException() );
} }
public void testConfigurationOnlyUserSettingsAreActiveAndItIsInvalid() public void testConfigurationOnlyUserSettingsAreActiveAndItIsInvalid()
@ -51,8 +55,12 @@ public class ValidateConfigurationTest
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration ); ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isUserSettingsFilePresent() ); assertTrue( result.isUserSettingsFilePresent() );
assertFalse( result.isUserSettingsFileParses() ); assertFalse( result.isUserSettingsFileParses() );
assertNull( result.getUserSettings() );
assertNotNull( result.getUserSettingsException() );
assertTrue( result.getUserSettingsException() instanceof XmlPullParserException );
assertNull( result.getGlobalSettings() );
assertNull( result.getGlobalSettingsException() );
} }
public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsValid() public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsValid()
@ -65,8 +73,11 @@ public class ValidateConfigurationTest
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration ); ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isGlobalSettingsFilePresent() ); assertTrue( result.isGlobalSettingsFilePresent() );
assertTrue( result.isGlobalSettingsFileParses() ); assertTrue( result.isGlobalSettingsFileParses() );
assertNotNull( result.getGlobalSettings() );
assertNull( result.getGlobalSettingsException() );
assertNull( result.getUserSettings() );
assertNull( result.getUserSettingsException() );
} }
public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsInvalid() public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsInvalid()
@ -79,7 +90,11 @@ public class ValidateConfigurationTest
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration ); ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isGlobalSettingsFilePresent() ); assertTrue( result.isGlobalSettingsFilePresent() );
assertFalse( result.isGlobalSettingsFileParses() ); assertFalse( result.isGlobalSettingsFileParses() );
assertNull( result.getGlobalSettings() );
assertNotNull( result.getGlobalSettingsException() );
assertTrue( result.getGlobalSettingsException() instanceof XmlPullParserException );
assertNull( result.getUserSettings() );
assertNull( result.getUserSettingsException() );
} }
} }