[MNG-7230] Replace assert by simpler but equivalent calls

This closes #111
This commit is contained in:
Arturo Bernal 2021-09-05 11:23:34 +02:00 committed by Michael Osipov
parent 4d3a6397fe
commit d70be17830
16 changed files with 33 additions and 25 deletions

View File

@ -19,12 +19,13 @@ package org.apache.maven.it;
* under the License.
*/
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Properties;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-469">MNG-469</a>.
*
@ -100,7 +101,7 @@ public class MavenITmng0469ReportConfigTest
verifier.executeGoal( "validate" );
Properties props = verifier.loadProperties( "target/config.properties" );
assertEquals( "maven-it-plugin-site", props.getProperty( "project.reporting.plugins.0.artifactId" ) );
assertFalse( "fail.properties".equals( props.getProperty( "project.reporting.plugins.0.configuration.children.infoFile.0.value" ) ) );
assertNotEquals( "fail.properties", props.getProperty( "project.reporting.plugins.0.configuration.children.infoFile.0.value" ) );
}
verifier.verifyErrorFreeLog();
verifier.resetStreams();

View File

@ -25,6 +25,8 @@ import java.util.Properties;
import org.apache.maven.it.util.ResourceExtractor;
import org.apache.maven.shared.utils.io.FileUtils;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-1751">MNG-1751</a>.
*
@ -77,7 +79,7 @@ public class MavenITmng1751ForcedMetadataUpdateDuringDeploymentTest
Properties checksums = verifier.loadProperties( "target/checksum.properties" );
String sha1 = checksums.getProperty( "dep-0.1-SNAPSHOT.jar", "" ).toLowerCase( java.util.Locale.ENGLISH );
assertEquals( sha1, 40, sha1.length() );
assertFalse( "fc081cd365b837dcb01eb9991f21c409b155ea5c".equals( sha1 ) );
assertNotEquals( "fc081cd365b837dcb01eb9991f21c409b155ea5c", sha1 );
}
}

View File

@ -25,6 +25,8 @@ import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Properties;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3422">MNG-3422</a>.
*
@ -56,8 +58,8 @@ public class MavenITmng3422ActiveComponentCollectionTest
verifier.resetStreams();
Properties props = verifier.loadProperties( "target/layout.properties" );
assertFalse( "0".equals( props.getProperty( "layouts", "0" ) ) );
assertFalse( "".equals( props.getProperty( "layouts.default", "" ) ) );
assertNotEquals( "0", props.getProperty( "layouts", "0" ) );
assertNotEquals( "", props.getProperty( "layouts.default", "" ) );
}
}

View File

@ -72,7 +72,7 @@ public class MavenITmng3807PluginConfigExpressionEvaluationTest
{
assertNotNull( value );
assertTrue( value.length() > 0 );
assertTrue( value, !value.contains( "${" ) );
assertFalse( value, value.contains( "${" ) );
}
}

View File

@ -20,7 +20,6 @@ package org.apache.maven.it;
*/
import java.io.File;
import java.util.Properties;
import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;

View File

@ -26,6 +26,8 @@ import java.util.Collection;
import java.util.Properties;
import java.util.TreeSet;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-3843">MNG-3843</a>.
*
@ -137,7 +139,7 @@ public class MavenITmng3843PomInheritanceTest
assertEquals( "child-1", props.getProperty( "project.artifactId" ) );
assertEquals( "0.1", props.getProperty( "project.version" ) );
assertEquals( "jar", props.getProperty( "project.packaging" ) );
assertFalse( "parent-name".equals( props.getProperty( "project.name" ) ) );
assertNotEquals( "parent-name", props.getProperty( "project.name" ) );
assertEquals( "parent-description", props.getProperty( "project.description", "" ) );
assertUrlCommon( "http://parent.url", props.getProperty( "project.url", "" ) );
assertEquals( "2008", props.getProperty( "project.inceptionYear", "" ) );

View File

@ -90,9 +90,9 @@ public class MavenITmng3933ProfilesXmlActivationTest
}
}
assertEquals( null, props.getProperty( "project.properties.sysPropertyMissing" ) );
assertEquals( null, props.getProperty( "project.properties.envPropertyMissing" ) );
assertEquals( null, props.getProperty( "project.properties.filePropertyMissing" ) );
assertNull( props.getProperty( "project.properties.sysPropertyMissing" ) );
assertNull( props.getProperty( "project.properties.envPropertyMissing" ) );
assertNull( props.getProperty( "project.properties.filePropertyMissing" ) );
}
}

View File

@ -60,7 +60,7 @@ public class MavenITmng4023ParentProfileOneTimeInjectionTest
Properties props = verifier.loadProperties( "sub/target/config.properties" );
assertEquals( "1", props.getProperty( "stringParams" ) );
assertEquals( "test", props.getProperty( "stringParams.0" ) );
assertEquals( null, props.getProperty( "stringParams.1" ) );
assertNull( props.getProperty( "stringParams.1" ) );
}
}

View File

@ -88,8 +88,8 @@ public class MavenITmng4053PluginConfigAttributesTest
assertEquals( "2", props.getProperty( "domParam.children.copy.0.attributes" ) );
assertEquals( "target", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.dir" ) );
assertEquals( null, props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.todir" ) );
assertEquals( null, props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.overwrite" ) );
assertNull( props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.todir" ) );
assertNull( props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes.overwrite" ) );
assertEquals( "1", props.getProperty( "domParam.children.copy.0.children.fileset.0.attributes" ) );
}

View File

@ -62,7 +62,7 @@ public class MavenITmng4361ForceDependencySnapshotUpdateTest
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
assertEquals( null, verifier.loadProperties( "target/checksum.properties" ).getProperty( "b-0.1-SNAPSHOT.jar" ) );
assertNull( verifier.loadProperties( "target/checksum.properties" ).getProperty( "b-0.1-SNAPSHOT.jar" ) );
filterProps.setProperty( "@repo@", "repo-2" );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );

View File

@ -68,7 +68,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
String pom = FileUtils.fileRead( installedPom, "UTF-8" );
assertTrue( pom.indexOf( "Branch-A" ) > 0 );
assertTrue( !pom.contains( "Branch-B" ) );
assertFalse( pom.contains( "Branch-B" ) );
assertEquals( aPom.length(), bPom.length() );
assertTrue( aPom.lastModified() > bPom.lastModified() );
@ -82,7 +82,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
verifier.resetStreams();
pom = FileUtils.fileRead( installedPom, "UTF-8" );
assertTrue( !pom.contains( "Branch-A" ) );
assertFalse( pom.contains( "Branch-A" ) );
assertTrue( pom.indexOf( "Branch-B" ) > 0 );
}
@ -120,7 +120,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
String data = FileUtils.fileRead( installedArtifact, "UTF-8" );
assertTrue( data.indexOf( "Branch-A" ) > 0 );
assertTrue( !data.contains( "Branch-B" ) );
assertFalse( data.contains( "Branch-B" ) );
assertEquals( aArtifact.length(), bArtifact.length() );
assertTrue( aArtifact.lastModified() > bArtifact.lastModified() );
@ -134,7 +134,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
verifier.resetStreams();
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
assertTrue( !data.contains( "Branch-A" ) );
assertFalse( data.contains( "Branch-A" ) );
assertTrue( data.indexOf( "Branch-B" ) > 0 );
long lastModified = installedArtifact.lastModified();
@ -150,7 +150,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
verifier.resetStreams();
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
assertTrue( !data.contains( "Branch-B" ) );
assertFalse( data.contains( "Branch-B" ) );
assertTrue( data.indexOf( "Branch-C" ) > 0 );
}

View File

@ -25,6 +25,8 @@ import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Properties;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-4474">MNG-4474</a>.
*
@ -59,7 +61,7 @@ public class MavenITmng4474PerLookupWagonInstantiationTest
assertNotNull( hash1 );
String hash2 = props.getProperty( "coreit://two.hash" );
assertNotNull( hash2 );
assertFalse( hash1.equals( hash2 ) );
assertNotEquals( hash1, hash2 );
}
}

View File

@ -25,6 +25,8 @@ import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Properties;
import static org.junit.Assert.assertNotEquals;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-4528">MNG-4528</a>.
*
@ -60,7 +62,7 @@ public class MavenITmng4528ExcludeWagonsFromMavenCoreArtifactsTest
Properties props = verifier.loadProperties( "target/wagon.properties" );
String version = props.getProperty( "version", "" );
assertFalse( "Bad wagon version used: " + version, version.equals( "1.0-alpha-6" ) );
assertNotEquals( "Bad wagon version used: " + version, "1.0-alpha-6", version );
}
}

View File

@ -4,7 +4,6 @@ import org.apache.maven.it.util.ResourceExtractor;
import org.junit.Test;
import java.io.File;
import java.util.Properties;
/**
* This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-6071">MNG-6071</a>:

View File

@ -74,7 +74,7 @@ public class MavenITmng6240PluginExtensionAetherProvider
count++;
}
}
assertTrue( count == 2 ); // 1 from download, 1 from upload
assertEquals( 2, count ); // 1 from download, 1 from upload
}

View File

@ -2,7 +2,6 @@ package org.apache.maven.it;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import org.apache.maven.it.util.ResourceExtractor;
import org.junit.Test;