1/******************************************************************************* 2 * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors 3 * This program and the accompanying materials are made available under 4 * the terms of the Eclipse Public License 2.0 which is available at 5 * http://www.eclipse.org/legal/epl-2.0 6 * 7 * SPDX-License-Identifier: EPL-2.0 8 * 9 * Contributors: 10 * Evgeny Mandrikov - initial API and implementation 11 * 12 *******************************************************************************/ 13import java.io.*; 14import org.codehaus.plexus.util.*; 15 16String buildLog = FileUtils.fileRead( new File( basedir, "build.log" ) ); 17if ( buildLog.indexOf( "Skipping JaCoCo execution due to missing classes directory." ) < 0 ) { 18 throw new RuntimeException( "Execution should be skipped when target/classes does not exist." ); 19} 20 21File dump2 = new File( basedir, "skip-child/target/jacoco.exec" ); 22if ( dump2.isFile() ) { 23 throw new RuntimeException( "Should not be executed for module 'skip-child', but dump found : " + dump2 ); 24} 25 26if ( !buildLog.contains( "argLine set to empty" ) ) { 27 throw new RuntimeException( "Property not set to empty when skipping." ); 28} 29 30File file = new File( basedir, "child/target/jacoco.exec" ); 31if ( !file.isFile() ) 32{ 33 throw new FileNotFoundException( "Could not find generated dump: " + file ); 34} 35 36File xmlReport = new File( basedir, "child/target/site/jacoco/jacoco.xml" ); 37if ( !xmlReport.isFile() ) 38{ 39 throw new FileNotFoundException( "Could not find generated XML report: " + xmlReport ); 40} 41 42File csvReport = new File( basedir, "child/target/site/jacoco/jacoco.csv" ); 43if ( !csvReport.isFile() ) 44{ 45 throw new FileNotFoundException( "Could not find generated CSV report: " + csvReport ); 46} 47 48File htmlReport = new File( basedir, "child/target/site/jacoco/index.html" ); 49if ( !htmlReport.isFile() ) 50{ 51 throw new FileNotFoundException( "Could not find generated HTML report: " + htmlReport ); 52} 53