From b048c5365a10a0dcce4dbf80ae268441b6ea2008 Mon Sep 17 00:00:00 2001 From: Andres Almiray Date: Fri, 25 Jun 2021 20:48:05 +0200 Subject: [PATCH] [MSHADE-382] Apply review suggestions - remove unit test case - change it verification script from .bsh to .groovy Co-authored-by: Markus Karg --- .../{verify.bsh => verify.groovy} | 8 +--- .../plugins/shade/mojo/ShadeMojoTest.java | 37 ------------------- 2 files changed, 1 insertion(+), 44 deletions(-) rename src/it/projects/MSHADE-382_skip_execution/{verify.bsh => verify.groovy} (79%) diff --git a/src/it/projects/MSHADE-382_skip_execution/verify.bsh b/src/it/projects/MSHADE-382_skip_execution/verify.groovy similarity index 79% rename from src/it/projects/MSHADE-382_skip_execution/verify.bsh rename to src/it/projects/MSHADE-382_skip_execution/verify.groovy index eb14cad7..377c5f39 100644 --- a/src/it/projects/MSHADE-382_skip_execution/verify.bsh +++ b/src/it/projects/MSHADE-382_skip_execution/verify.groovy @@ -16,11 +16,5 @@ * specific language governing permissions and limitations * under the License. */ -import java.io.*; -File originalJarFile = new File( basedir, "target/original-skip-execution-1.0.jar" ); - -if ( originalJarFile.exists() ) -{ - throw new IllegalStateException( "Shading was not skipped." ); -} \ No newline at end of file +assert !(new File( basedir, "target/original-skip-execution-1.0.jar" ).exists()) : "Shading was not skipped." \ No newline at end of file diff --git a/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java b/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java index 5929eebc..181287cd 100644 --- a/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/shade/mojo/ShadeMojoTest.java @@ -62,43 +62,6 @@ public class ShadeMojoTest extends PlexusTestCase { - public void testSkipShading() throws Exception - { - final ShadeMojo mojo = new ShadeMojo(); - - Exception thrown = null; - try - { - // execute without configuration expecting a failure - mojo.execute(); - } - catch( Exception expected ) - { - thrown = expected; - } - - assertNotNull( thrown ); - - // set skip = true - Field skip = ShadeMojo.class.getDeclaredField( "skip" ); - skip.setAccessible( true ); - skip.set( mojo, Boolean.TRUE ); - - thrown = null; - try - { - // execute without configuration and skip - // should not cause any exceptions - mojo.execute(); - } - catch( Exception unexpected ) - { - thrown = unexpected; - } - - assertNull( thrown ); - } - public void testManifestTransformerSelection() throws Exception { final ShadeMojo mojo = new ShadeMojo();