import java.io.*; import java.util.jar.*; String[] wanted = { "Main.class", "junit/framework/TestCase.class", "junit/swingui/icons/error.gif", }; String[] unwanted = { "junit/swingui/TestRunner.class", }; JarFile jarFile = new JarFile( new File( basedir, "target/test-1.0.jar" ) ); for ( String path : wanted ) { if ( jarFile.getEntry( path ) == null ) { throw new IllegalStateException( "wanted path is missing: " + path ); } } for ( String path : unwanted ) { if ( jarFile.getEntry( path ) != null ) { throw new IllegalStateException( "unwanted path is present: " + path ); } } jarFile.close();