You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by hb...@apache.org on 2011/02/26 00:35:59 UTC
svn commit: r1074749 -
/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/
Author: hboutemy
Date: Fri Feb 25 23:35:59 2011
New Revision: 1074749
URL: http://svn.apache.org/viewvc?rev=1074749&view=rev
Log:
code formatting
Modified:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire141PluggableProvidersIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AbstractTestSingleMethod.java Fri Feb 25 23:35:59 2011
@@ -1,6 +1,5 @@
package org.apache.maven.surefire.its;
-import java.util.Arrays;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/AsbtractTestMethodPattern.java Fri Feb 25 23:35:59 2011
@@ -1,12 +1,5 @@
package org.apache.maven.surefire.its;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.maven.it.Verifier;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/CheckTestNgSuiteXmlSingleIT.java Fri Feb 25 23:35:59 2011
@@ -38,7 +38,7 @@ public class CheckTestNgSuiteXmlSingleIT
public void testTestNGSuite()
throws Exception
{
- addGoal( "-Dtest=TestNGTestTwo" );
+ addGoal( "-Dtest=TestNGTestTwo" );
executeTest();
verifyErrorFreeLog();
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/HelperAssertions.java Fri Feb 25 23:35:59 2011
@@ -100,9 +100,9 @@ public class HelperAssertions
File testDir = testDirs[i];
File reportsDir = new File( testDir, "target/surefire-reports" );
Assert.assertTrue( "Reports directory is missing: " + reportsDir.getAbsolutePath(), reportsDir.exists() );
- reportsDirs.add( reportsDir);
+ reportsDirs.add( reportsDir );
}
- SurefireReportParser parser = new SurefireReportParser(reportsDirs, Locale.getDefault());
+ SurefireReportParser parser = new SurefireReportParser( reportsDirs, Locale.getDefault() );
List reports;
try
{
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4ForkAlwaysStaticInitPollutionIT.java Fri Feb 25 23:35:59 2011
@@ -37,7 +37,7 @@ public class JUnit4ForkAlwaysStaticInitP
public void testJunit4Ignore()
throws Exception
{
- this.executeTest( );
+ this.executeTest();
verifyErrorFreeLog();
assertTestSuiteResults( 2, 0, 0, 0 );
}
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnit4RunListenerIT.java Fri Feb 25 23:35:59 2011
@@ -29,32 +29,33 @@ import java.io.File;
* @author <a href="mailto:matthew.gilliard@gmail.com">Matthew Gilliard</a>
*/
public class JUnit4RunListenerIT
- extends SurefireVerifierTestClass {
+ extends SurefireVerifierTestClass
+{
public JUnit4RunListenerIT()
{
super( "/junit4-runlistener" );
}
public void testJUnit4RunListener()
- throws Exception {
+ throws Exception
+ {
addGoal( "-Dprovider=surefire-junit4" );
addGoal( "-DjunitVersion=4.4" );
executeTest();
- verifyErrorFreeLog();
+ verifyErrorFreeLog();
assertResults();
- }
+ }
private void assertResults()
throws MavenReportException
{
assertTestSuiteResults( 1, 0, 0, 0 );
- final File targetDir = getSubFile( "target");
+ final File targetDir = getSubFile( "target" );
- assertFileExists(new File(targetDir, "runlistener-output-1.txt"));
- assertFileExists(new File(targetDir, "runlistener-output-2.txt"));
+ assertFileExists( new File( targetDir, "runlistener-output-1.txt" ) );
+ assertFileExists( new File( targetDir, "runlistener-output-2.txt" ) );
}
-
public void testRunlistenerJunitCoreProvider()
throws Exception
{
@@ -65,8 +66,9 @@ public class JUnit4RunListenerIT
assertResults();
}
- private void assertFileExists(final File file) {
- assertTrue("File doesn't exist: " + file.getAbsolutePath(), file.exists());
+ private void assertFileExists( final File file )
+ {
+ assertTrue( "File doesn't exist: " + file.getAbsolutePath(), file.exists() );
}
}
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Junit4IgnoreIT.java Fri Feb 25 23:35:59 2011
@@ -35,7 +35,7 @@ public class Junit4IgnoreIT
public void testJunit4Ignore()
throws Exception
{
- executeTest( );
+ executeTest();
verifyErrorFreeLog();
assertTestSuiteResults( 1, 0, 0, 1 );
}
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire141PluggableProvidersIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire141PluggableProvidersIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire141PluggableProvidersIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire141PluggableProvidersIT.java Fri Feb 25 23:35:59 2011
@@ -48,8 +48,8 @@ public class Surefire141PluggableProvide
verifier.setCliOptions( new ArrayList( Arrays.asList( opts ) ) );
this.executeGoal( verifier, "install" );
- verifier.verifyTextInLog("Using configured provider org.apache.maven.surefire.testprovider.TestProvider");
- verifier.verifyTextInLog("Using configured provider org.apache.maven.surefire.junit.JUnit3Provider");
+ verifier.verifyTextInLog( "Using configured provider org.apache.maven.surefire.testprovider.TestProvider" );
+ verifier.verifyTextInLog( "Using configured provider org.apache.maven.surefire.junit.JUnit3Provider" );
verifier.verifyErrorFreeLog();
}
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/Surefire260TestWithIdenticalNamesIT.java Fri Feb 25 23:35:59 2011
@@ -54,14 +54,15 @@ public class Surefire260TestWithIdentica
final URI uri = siteFile.toURI();
final WebClient webClient = new WebClient();
- webClient.setJavaScriptEnabled(true);
- final HtmlPage page = webClient.getPage(uri.toURL());
+ webClient.setJavaScriptEnabled( true );
+ final HtmlPage page = webClient.getPage( uri.toURL() );
- final HtmlAnchor a = (HtmlAnchor) page.getByXPath("//a[contains(@href, 'surefire260_TestB_testDup')]").get(0);
- final HtmlDivision content = (HtmlDivision) page.getElementById("surefire260_TestB_testDuperror");
- assertTrue(content.getAttribute("style").contains("none"));
+ final HtmlAnchor a =
+ (HtmlAnchor) page.getByXPath( "//a[contains(@href, 'surefire260_TestB_testDup')]" ).get( 0 );
+ final HtmlDivision content = (HtmlDivision) page.getElementById( "surefire260_TestB_testDuperror" );
+ assertTrue( content.getAttribute( "style" ).contains( "none" ) );
a.click();
- assertFalse(content.getAttribute("style").contains("none"));
+ assertFalse( content.getAttribute( "style" ).contains( "none" ) );
webClient.closeAllWindows();
}
}
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/SurefireVerifierTestClass.java Fri Feb 25 23:35:59 2011
@@ -47,7 +47,9 @@ import java.util.List;
*
* @author Kristian Rosenvold
*/
-public abstract class SurefireVerifierTestClass extends TestCase {
+public abstract class SurefireVerifierTestClass
+ extends TestCase
+{
private final File testDir;
private final List<String> cliOptions = new ArrayList<String>();
@@ -56,76 +58,94 @@ public abstract class SurefireVerifierTe
private final Verifier verifier;
- private final String testNgVersion = System.getProperty("testng.version");
+ private final String testNgVersion = System.getProperty( "testng.version" );
- private final String surefireVersion = System.getProperty("surefire.version");
+ private final String surefireVersion = System.getProperty( "surefire.version" );
-
- protected SurefireVerifierTestClass(String testProject) {
- try {
- testDir = simpleExtractResources(getClass(), testProject);
+ protected SurefireVerifierTestClass( String testProject )
+ {
+ try
+ {
+ testDir = simpleExtractResources( getClass(), testProject );
this.goals = getInitialGoals();
- this.verifier = new Verifier(testDir.getAbsolutePath());
- } catch (VerificationException e) {
- throw new NestedRuntimeException(e);
- } catch (IOException e) {
- throw new NestedRuntimeException(e);
+ this.verifier = new Verifier( testDir.getAbsolutePath() );
+ }
+ catch ( VerificationException e )
+ {
+ throw new NestedRuntimeException( e );
+ }
+ catch ( IOException e )
+ {
+ throw new NestedRuntimeException( e );
}
}
- private File simpleExtractResources(Class cl, String resourcePath) throws IOException {
+ private File simpleExtractResources( Class cl, String resourcePath )
+ throws IOException
+ {
String tempDirPath = System.getProperty( "maven.test.tmpdir", System.getProperty( "java.io.tmpdir" ) );
- File tempDir = new File(tempDirPath, this.getClass().getSimpleName());
+ File tempDir = new File( tempDirPath, this.getClass().getSimpleName() );
System.out.println( "tempDir = " + tempDir );
File testDir = new File( tempDir, resourcePath );
FileUtils.deleteDirectory( testDir );
- return ResourceExtractor.extractResourcePath(cl, resourcePath, tempDir, true);
+ return ResourceExtractor.extractResourcePath( cl, resourcePath, tempDir, true );
}
-
-
- protected void reset(){
+ protected void reset()
+ {
goals.clear();
- goals.addAll( getInitialGoals() );
+ goals.addAll( getInitialGoals() );
cliOptions.clear();
}
- private List<String> getInitialGoals() {
+ private List<String> getInitialGoals()
+ {
List<String> goals1 = new ArrayList<String>();
- goals1.add("-Dsurefire.version=" + surefireVersion);
-
- if (testNgVersion != null) {
- goals1.add("-DtestNgVersion=" + testNgVersion);
+ goals1.add( "-Dsurefire.version=" + surefireVersion );
- ArtifactVersion v = new DefaultArtifactVersion(testNgVersion);
- try {
- if (VersionRange.createFromVersionSpec("(,5.12.1)").containsVersion(v)) {
- goals1.add("-DtestNgClassifier=jdk15");
+ if ( testNgVersion != null )
+ {
+ goals1.add( "-DtestNgVersion=" + testNgVersion );
+
+ ArtifactVersion v = new DefaultArtifactVersion( testNgVersion );
+ try
+ {
+ if ( VersionRange.createFromVersionSpec( "(,5.12.1)" ).containsVersion( v ) )
+ {
+ goals1.add( "-DtestNgClassifier=jdk15" );
}
- } catch (InvalidVersionSpecificationException e) {
- throw new NestedRuntimeException(e.getMessage(), e);
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new NestedRuntimeException( e.getMessage(), e );
}
}
return goals1;
}
- protected List<String> getInitialGoals(String testNgVersion) {
+ protected List<String> getInitialGoals( String testNgVersion )
+ {
List<String> goals = new ArrayList<String>();
- goals.add("-Dsurefire.version=" + surefireVersion);
-
- if (testNgVersion != null) {
- goals.add("-DtestNgVersion=" + testNgVersion);
+ goals.add( "-Dsurefire.version=" + surefireVersion );
- ArtifactVersion v = new DefaultArtifactVersion(testNgVersion);
- try {
- if (VersionRange.createFromVersionSpec("(,5.12.1)").containsVersion(v)) {
- goals.add("-DtestNgClassifier=jdk15");
+ if ( testNgVersion != null )
+ {
+ goals.add( "-DtestNgVersion=" + testNgVersion );
+
+ ArtifactVersion v = new DefaultArtifactVersion( testNgVersion );
+ try
+ {
+ if ( VersionRange.createFromVersionSpec( "(,5.12.1)" ).containsVersion( v ) )
+ {
+ goals.add( "-DtestNgClassifier=jdk15" );
}
- } catch (InvalidVersionSpecificationException e) {
- throw new NestedRuntimeException(e.getMessage(), e);
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw new NestedRuntimeException( e.getMessage(), e );
}
}
@@ -138,137 +158,174 @@ public abstract class SurefireVerifierTe
* @param path The subdirectory under basedir
* @return A file
*/
- protected File getSubFile(String path) {
- return new File(testDir, path);
+ protected File getSubFile( String path )
+ {
+ return new File( testDir, path );
}
- protected void assertPresent(File file) {
- verifier.assertFilePresent(file.getAbsolutePath());
+ protected void assertPresent( File file )
+ {
+ verifier.assertFilePresent( file.getAbsolutePath() );
}
- protected void assertNotPresent(File file) {
- verifier.assertFileNotPresent(file.getAbsolutePath());
+ protected void assertNotPresent( File file )
+ {
+ verifier.assertFileNotPresent( file.getAbsolutePath() );
}
- protected void showErrorStackTraces() {
- cliOptions.add("-e");
+ protected void showErrorStackTraces()
+ {
+ cliOptions.add( "-e" );
}
- protected void debugLogging() {
- cliOptions.add("-X");
+ protected void debugLogging()
+ {
+ cliOptions.add( "-X" );
}
-
- protected void failNever() {
- cliOptions.add("-fn");
+ protected void failNever()
+ {
+ cliOptions.add( "-fn" );
}
- protected SurefireVerifierTestClass addGoal(String goal) {
- goals.add(goal);
+ protected SurefireVerifierTestClass addGoal( String goal )
+ {
+ goals.add( goal );
return this;
}
- protected Verifier executeTest() throws VerificationException {
- return execute("test");
+ protected Verifier executeTest()
+ throws VerificationException
+ {
+ return execute( "test" );
}
- protected Verifier execute(String goal) throws VerificationException {
- addGoal(goal);
- verifier.setCliOptions(cliOptions);
- try {
- verifier.executeGoals(goals);
+ protected Verifier execute( String goal )
+ throws VerificationException
+ {
+ addGoal( goal );
+ verifier.setCliOptions( cliOptions );
+ try
+ {
+ verifier.executeGoals( goals );
return verifier;
- } finally {
+ }
+ finally
+ {
verifier.resetStreams();
}
}
- protected File getSurefireReportsFile(String fileName) {
- File targetDir = getSubFile("target/surefire-reports");
- return new File(targetDir, fileName);
+ protected File getSurefireReportsFile( String fileName )
+ {
+ File targetDir = getSubFile( "target/surefire-reports" );
+ return new File( targetDir, fileName );
}
- protected File getSiteFile(String fileName) {
- File targetDir = getSubFile("target/site");
- return new File(targetDir, fileName);
+ protected File getSiteFile( String fileName )
+ {
+ File targetDir = getSubFile( "target/site" );
+ return new File( targetDir, fileName );
}
- protected void printSummary(boolean printsummary) {
- addGoal("-DprintSummary=" + printsummary);
+ protected void printSummary( boolean printsummary )
+ {
+ addGoal( "-DprintSummary=" + printsummary );
}
- protected void redirectToFile(boolean redirect) {
- addGoal("-Dredirect.to.file=" + redirect);
+ protected void redirectToFile( boolean redirect )
+ {
+ addGoal( "-Dredirect.to.file=" + redirect );
}
- protected void forkOnce() {
- forkMode("once");
+ protected void forkOnce()
+ {
+ forkMode( "once" );
}
- protected void forkNever() {
- forkMode("never");
+ protected void forkNever()
+ {
+ forkMode( "never" );
}
- protected void forkAlways() {
- forkMode("always");
+ protected void forkAlways()
+ {
+ forkMode( "always" );
}
- protected void forkMode(String forkMode) {
- addGoal("-DforkMode=" + forkMode);
+ protected void forkMode( String forkMode )
+ {
+ addGoal( "-DforkMode=" + forkMode );
}
- protected void activateProfile(String profile) {
- addGoal("-P" + profile);
+ protected void activateProfile( String profile )
+ {
+ addGoal( "-P" + profile );
}
-
- public void assertTestSuiteResults(int total, int errors, int failures, int skipped) throws MavenReportException {
- HelperAssertions.assertTestSuiteResults(total, errors, failures, skipped, testDir);
+ public void assertTestSuiteResults( int total, int errors, int failures, int skipped )
+ throws MavenReportException
+ {
+ HelperAssertions.assertTestSuiteResults( total, errors, failures, skipped, testDir );
}
- public void verifyTextInLog(String text) throws VerificationException
+ public void verifyTextInLog( String text )
+ throws VerificationException
{
- verifier.verifyTextInLog(text);
+ verifier.verifyTextInLog( text );
}
- protected void verifyErrorFreeLog() throws VerificationException {
+ protected void verifyErrorFreeLog()
+ throws VerificationException
+ {
verifier.verifyErrorFreeLog();
}
- protected Verifier getVerifier() {
+ protected Verifier getVerifier()
+ {
return verifier;
}
- public File getTestDir() {
+ public File getTestDir()
+ {
return testDir;
}
- protected boolean assertContainsText(File file, String text) throws VerificationException {
- final List<String> list = getVerifier().loadFile(file, false);
- for (String line : list) {
+ protected boolean assertContainsText( File file, String text )
+ throws VerificationException
+ {
+ final List<String> list = getVerifier().loadFile( file, false );
+ for ( String line : list )
+ {
- if (line.contains(text)) {
+ if ( line.contains( text ) )
+ {
return true;
}
}
- Assert.fail("Did not find expected message in log");
+ Assert.fail( "Did not find expected message in log" );
return false; // doh
}
- protected boolean isMaven3X(){
- return matchesVersionRange("[3.0,)");
+ protected boolean isMaven3X()
+ {
+ return matchesVersionRange( "[3.0,)" );
}
-
- private DefaultArtifactVersion getMavenVersion() {
- try {
+ private DefaultArtifactVersion getMavenVersion()
+ {
+ try
+ {
String v = verifier.getMavenVersion();
// NOTE: If the version looks like "${...}" it has been configured from an undefined expression
- if (v != null && v.length() > 0 && !v.startsWith("${")) {
- return new DefaultArtifactVersion(v);
+ if ( v != null && v.length() > 0 && !v.startsWith( "${" ) )
+ {
+ return new DefaultArtifactVersion( v );
}
- } catch (VerificationException e) {
- throw new NestedRuntimeException(e);
+ }
+ catch ( VerificationException e )
+ {
+ throw new NestedRuntimeException( e );
}
return null;
@@ -279,19 +336,26 @@ public abstract class SurefireVerifierTe
* by allowing tests to adjust to the current maven version, or else simply avoid
* executing altogether if the wrong version is present.
*/
- private boolean matchesVersionRange(String versionRangeStr) {
+ private boolean matchesVersionRange( String versionRangeStr )
+ {
VersionRange versionRange;
- try {
- versionRange = VersionRange.createFromVersionSpec(versionRangeStr);
- } catch (InvalidVersionSpecificationException e) {
- throw (RuntimeException) new IllegalArgumentException("Invalid version range: " + versionRangeStr).initCause(e);
+ try
+ {
+ versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
+ }
+ catch ( InvalidVersionSpecificationException e )
+ {
+ throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr ).initCause( e );
}
ArtifactVersion version = getMavenVersion();
- if (version != null) {
- return versionRange.containsVersion(version);
- } else {
- throw new IllegalStateException("Cannot determine maven version");
+ if ( version != null )
+ {
+ return versionRange.containsVersion( version );
+ }
+ else
+ {
+ throw new IllegalStateException( "Cannot determine maven version" );
}
}
@@ -301,5 +365,3 @@ public abstract class SurefireVerifierTe
}
}
-
-
Modified: maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java?rev=1074749&r1=1074748&r2=1074749&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java (original)
+++ maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/WorkingDirectoryIT.java Fri Feb 25 23:35:59 2011
@@ -79,7 +79,7 @@ public class WorkingDirectoryIT
assertNotNull( "user.dir was null in property file", userDirPath );
File userDir = new File( userDirPath );
// test if not a symlink
- if ( childTestDir.getCanonicalFile().equals(childTestDir.getAbsoluteFile()) )
+ if ( childTestDir.getCanonicalFile().equals( childTestDir.getAbsoluteFile() ) )
{
assertEquals( "wrong user.dir ! symlink ", childTestDir.getAbsolutePath(), userDir.getAbsolutePath() );
}