| 1 |
log = new File( basedir, 'build.log' ) |
| 2 |
assert log.exists() |
| 3 |
|
| 4 |
// |
| 5 |
// #1) Validate the informational messages used in the MavenMessageHandler to define the detail level. |
| 6 |
// |
| 7 |
messageDetailNote = log.readLines().find { |
| 8 |
line -> line.contains( '[INFO] Showing AJC message detail for messages of types: [error, warning, fail]' |
| 9 |
)} |
| 10 |
assert messageDetailNote != null |
| 11 |
|
| 12 |
// |
| 13 |
// #2) Validate the exception messages, including line numbers and contexts |
| 14 |
// |
| 15 |
warning1 = log.readLines().find { |
| 16 |
line -> line.contains( '[WARNING] no match for this type name: ATestCase [Xlint:invalidAbsoluteTypeName]' |
| 17 |
)} |
| 18 |
warning1TypeAndLineNumber = log.readLines().find { |
| 19 |
line -> line.contains( 'LineNumbersInAjcWarnings/src/main/aspect/Azpect.java:41'.replace('/', File.separator) |
| 20 |
)} |
| 21 |
warning1Context = log.readLines().find { |
| 22 |
line -> line.contains( '@Before ("execution (* ATestCase.*(..))")' |
| 23 |
)} |
| 24 |
warning2 = log.readLines().find { |
| 25 |
line -> line.contains( '[WARNING] The import java.io.File is never used' |
| 26 |
)} |
| 27 |
warning2TypeAndLineNumber = log.readLines().find { |
| 28 |
line -> line.contains( 'LineNumbersInAjcWarnings/src/main/java/Clazz.java:3'.replace('/', File.separator) |
| 29 |
)} |
| 30 |
warning2Context = log.readLines().find { |
| 31 |
line -> line.contains( 'import java.io.File;' |
| 32 |
)} |
| 33 |
warning3 = log.readLines().find { |
| 34 |
line -> line.contains( '[WARNING] The value of the parameter anUnusedArgument is not used' |
| 35 |
)} |
| 36 |
warning3TypeAndLineNumber = log.readLines().find { |
| 37 |
line -> line.contains( 'LineNumbersInAjcWarnings/src/main/java/Clazz.java:14'.replace('/', File.separator) |
| 38 |
)} |
| 39 |
warning3Context = log.readLines().find { |
| 40 |
line -> line.contains( 'public void print( String anUnusedArgument )' |
| 41 |
)} |
| 42 |
warning4 = log.readLines().find { |
| 43 |
line -> line.contains( '[WARNING] The value of the local variable anUnusedLocalVariable is not used' |
| 44 |
)} |
| 45 |
warning4TypeAndLineNumber = log.readLines().find { |
| 46 |
line -> line.contains( 'LineNumbersInAjcWarnings/src/main/java/Clazz.java:16'.replace('/', File.separator) |
| 47 |
)} |
| 48 |
warning4Context = log.readLines().find { |
| 49 |
line -> line.contains( 'final int anUnusedLocalVariable = 42;' |
| 50 |
)} |
| 51 |
|
| 52 |
// Validate that we have found the required lines |
| 53 |
assert warning1 != null |
| 54 |
assert warning1TypeAndLineNumber != null |
| 55 |
assert warning1Context != null |
| 56 |
assert warning2 != null |
| 57 |
assert warning2TypeAndLineNumber != null |
| 58 |
assert warning2Context != null |
| 59 |
assert warning3 != null |
| 60 |
assert warning3TypeAndLineNumber != null |
| 61 |
assert warning3Context != null |
| 62 |
assert warning4 != null |
| 63 |
assert warning4TypeAndLineNumber != null |
| 64 |
assert warning4Context != null |