com.atlassian.bamboo.utils
Class BambooTestUtils

java.lang.Object
  extended by com.atlassian.bamboo.utils.BambooTestUtils

public class BambooTestUtils
extends java.lang.Object

This class provides a collection of utility methods for use in the unit tests


Field Summary
static java.lang.String NL
          Convenience constant for new line
static java.lang.String SEP
          Convenice constant for file separators
 
Method Summary
static void assertCollectionContains(java.lang.String message, java.util.Collection collection, java.lang.Object value)
          Ensures the value is contained in the collection.
static void assertFormError(ErrorCollection errorCollection, java.lang.String field, java.lang.String errorMessage)
           
static java.io.File getFileFromResourceDirectory(java.lang.Object object, java.lang.String fileName)
           
static java.io.InputStream getInputStream(java.lang.String fileName)
          Obtains the given fileName as an input stream.
static java.io.InputStream getInputStream(java.lang.String fileName, java.lang.Class<?> clazz)
          Obtains the given fileName as an input stream.
static java.io.InputStream getInputStream(java.lang.String fileName, java.lang.Object object)
          Obtains the given fileName as an input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NL

public static final java.lang.String NL
Convenience constant for new line


SEP

public static final java.lang.String SEP
Convenice constant for file separators

Method Detail

getInputStream

public static java.io.InputStream getInputStream(java.lang.String fileName)
Obtains the given fileName as an input stream. Assumes the file is located in the test source tree,

Parameters:
fileName - The file to read as a stream
Returns:
The stream

getInputStream

public static java.io.InputStream getInputStream(@NotNull
                                                 java.lang.String fileName,
                                                 @NotNull
                                                 java.lang.Object object)
Obtains the given fileName as an input stream. Assumes the file is located in the test source tree,

Parameters:
fileName - The file to read as a stream
object - This object's class is used to load resource
Returns:
The stream

getInputStream

public static java.io.InputStream getInputStream(java.lang.String fileName,
                                                 java.lang.Class<?> clazz)
Obtains the given fileName as an input stream. Assumes the file is located in the test source tree,

Parameters:
fileName - The resource name
clazz - The class to be used to load resource
Returns:
The stream

assertCollectionContains

public static void assertCollectionContains(java.lang.String message,
                                            java.util.Collection collection,
                                            java.lang.Object value)
Ensures the value is contained in the collection.

Parameters:
message - The message to display if the collection does not contain the value
collection - The collection we are searching
value - The value we are looking for in the collection

assertFormError

public static void assertFormError(ErrorCollection errorCollection,
                                   java.lang.String field,
                                   java.lang.String errorMessage)

getFileFromResourceDirectory

public static java.io.File getFileFromResourceDirectory(java.lang.Object object,
                                                        java.lang.String fileName)
                                                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011 Atlassian. All Rights Reserved.