forked from mojohaus/versions
/
verify.groovy
42 lines (33 loc) · 1.36 KB
/
verify.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Fragment
{
private fragment
Fragment( output, beginString, endString )
{
def startIndex = output.indexOf( beginString )
def endIndex = output.indexOf( endString, startIndex )
assert startIndex != -1
assert endIndex != -1
fragment = output.substring( startIndex, endIndex + endString.length() )
}
def contains( String searchString )
{
return fragment.contains( searchString )
}
String toString()
{
return fragment
}
}
def output = new File( basedir, 'target/property-updates-report.xml' ).text
.replaceAll( '\\n', '' )
.replaceAll( '\\r', '' )
summary = new Fragment( output, '<summary>', '</summary>' )
assert summary.contains( '<usingLastVersion>1</usingLastVersion>' )
assert summary.contains( '<nextIncrementalAvailable>1</nextIncrementalAvailable>' )
assert summary.contains( '<nextMinorAvailable>1</nextMinorAvailable>' )
assert new Fragment( output, '<propertyName>api-version</propertyName>',
'</property>' ).contains( '<status>incremental available</status>' )
assert new Fragment( output, '<propertyName>impl-version</propertyName>',
'</property>' ).contains( '<status>minor available</status>' )
assert new Fragment( output, '<propertyName>plugin-version</propertyName>',
'</property>' ).contains( '<status>no new available</status>' )