com.atlassian.jira.functest.matcher
Class BuildNumberMatcher

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<InputStream>
          extended by com.atlassian.jira.functest.matcher.DocumentMatcher
              extended by com.atlassian.jira.functest.matcher.BuildNumberMatcher
All Implemented Interfaces:
org.hamcrest.Matcher<InputStream>, org.hamcrest.SelfDescribing

public class BuildNumberMatcher
extends DocumentMatcher

Hamcrest matcher used to verify that a JIRA XML backup has a given build number in it. This is used in upgrade task tests to ensure that the upgrade is actually being performed.

Since:
v5.0

Constructor Summary
BuildNumberMatcher(int expectedBuildNumber)
          Creates a new BuildNumberMatcher.
 
Method Summary
 void describeTo(org.hamcrest.Description description)
           
static BuildNumberMatcher hasBuildNumber(int buildNumber)
          Does the backup file have the given build number.
protected  boolean matchesDocument(Document doc)
           
protected  int readBuildNumberFrom(Document doc)
          Reads the build number from a JIRA XML backup using DOM + XPath.
 
Methods inherited from class com.atlassian.jira.functest.matcher.DocumentMatcher
matchesSafely
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BuildNumberMatcher

public BuildNumberMatcher(int expectedBuildNumber)
Creates a new BuildNumberMatcher.

Parameters:
expectedBuildNumber - a build number
Method Detail

hasBuildNumber

public static BuildNumberMatcher hasBuildNumber(int buildNumber)
Does the backup file have the given build number.

Parameters:
buildNumber - a build number
Returns:
a BuildNumberMatcher

matchesDocument

protected boolean matchesDocument(@Nullable
                                  Document doc)
                           throws Exception
Specified by:
matchesDocument in class DocumentMatcher
Throws:
Exception

describeTo

public void describeTo(org.hamcrest.Description description)

readBuildNumberFrom

protected int readBuildNumberFrom(Document doc)
                           throws Exception
Reads the build number from a JIRA XML backup using DOM + XPath.

Parameters:
doc - a Document containing the XML backup
Returns:
an int containing the build number
Throws:
Exception - if anything goes wrong


Copyright © 2002-2012 Atlassian. All Rights Reserved.