| 1234567891011121314151617181920212223242526 |
- #!/usr/bin/env bash
-
- for file in `find . -name "*Test.java"`; do
- tempfile="/tmp/insert-ignores.tmp"
-
- echo -e "\n\n\n*** $file ******************************"
-
- #ignoreFound variable will check if already Ignore is imported or not.
- ignoreFound=`grep -q 'import org.junit.Ignore;' $file ; echo $?` > /dev/null
-
- #if ignore is not imported then add line for import
- if [ $ignoreFound -ne 0 ]
- then
- cat $file | sed 's/import org.junit.Test;/import org.junit.Test;\
- import org.junit.Ignore;/' > $tempfile
- mv "$tempfile" "$file"
- pwd
- fi
-
- # This AWK code will check for missing Ignore with the @Test and add it
-
- awk 'BEGIN{igonreset=0;firsttest=1}{if($0~/.*@Ignore.*/){igonreset=1}if($0 ~ /^.*@Test/){if(igonreset!=1 && firsttest==0){print " @Ignore(\"Remove to run test\")";}firsttest=0;igonreset=0}print $0}' $file > $tempfile
- mv "$tempfile" "$file"
- done
-
|