public abstract class RhnBaseTestCase
extends junit.framework.TestCase
Constructor and Description |
---|
RhnBaseTestCase()
Default Constructor
|
RhnBaseTestCase(java.lang.String name)
Constructs a TestCase with the given name.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertContains(java.util.Collection coll,
java.lang.Object elem)
Assert that
coll contains elem |
static void |
assertContains(java.lang.String body,
java.lang.String fragment)
Assert that
fragment is a substring of body |
static void |
assertContains(java.lang.String msg,
java.lang.String body,
java.lang.String fragment)
Assert that
fragment is a substring of body |
static void |
assertNotBefore(java.util.Date earlier,
java.util.Date later)
Assert that the date
later is after the date
earlier . |
static void |
assertNotBefore(java.lang.String msg,
java.util.Date earlier,
java.util.Date later)
Assert that the date
later is after the date
earlier . |
static void |
assertNotEmpty(java.util.Collection coll)
Assert that
coll is not empty |
static void |
assertNotEmpty(java.lang.String msg,
java.util.Collection coll)
Assert that
coll is not empty |
static void |
assertPropertyEquals(java.lang.String propName,
java.lang.Object exp,
java.lang.Object act)
Assert that the beans
exp and act have the same values
for property propName |
protected void |
clearSession() |
protected void |
commitAndCloseSession()
PLEASE Refrain from using this unless you really have to.
|
protected static void |
createDirIfNotExists(java.io.File dir) |
static void |
disableLocalizationServiceLogging()
Util for turning of the spew from the l10n service for
test cases that make calls with dummy string IDs.
|
static void |
enableLocalizationServiceLogging()
Util for turning on the spew from the l10n service for
test cases that make calls with dummy string IDs.
|
protected void |
flushAndEvict(java.lang.Object obj) |
protected java.util.Date |
getNow()
Get a date representing "now" and wait for one second to
ensure that future attempts to get a date will use a date
that is definitely later.
|
protected java.lang.Object |
reload(java.lang.Class objClass,
java.io.Serializable id) |
protected static java.lang.Object |
reload(java.lang.Object obj) |
protected void |
setUp()
Called once per test method.
|
protected void |
tearDown()
Tears down the fixture, and closes the HibernateSession.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
public RhnBaseTestCase(java.lang.String name)
name
- Name of TestCase.public RhnBaseTestCase()
protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
- if an error occurs during setup.protected void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
TestCase.tearDown()
,
HibernateFactory.closeSession()
protected void commitAndCloseSession() throws org.hibernate.HibernateException
org.hibernate.HibernateException
- hibernate exceptionprotected void clearSession()
protected void flushAndEvict(java.lang.Object obj) throws org.hibernate.HibernateException
org.hibernate.HibernateException
protected java.lang.Object reload(java.lang.Class objClass, java.io.Serializable id) throws org.hibernate.HibernateException
org.hibernate.HibernateException
protected static java.lang.Object reload(java.lang.Object obj) throws org.hibernate.HibernateException
org.hibernate.HibernateException
protected java.util.Date getNow()
public static void assertContains(java.util.Collection coll, java.lang.Object elem)
coll
contains elem
coll
- a collectionelem
- the element that should be in the collectionpublic static void assertNotEmpty(java.util.Collection coll)
coll
is not emptycoll
- the collectionpublic static void assertNotEmpty(java.lang.String msg, java.util.Collection coll)
coll
is not emptymsg
- the message to print if the assertion failscoll
- the collectionpublic static void assertPropertyEquals(java.lang.String propName, java.lang.Object exp, java.lang.Object act)
exp
and act
have the same values
for property propName
propName
- name of the proeprty to compareexp
- the bean with the expected valuesact
- the bean with the actual valuespublic static void assertNotBefore(java.util.Date earlier, java.util.Date later)
later
is after the date
earlier
. The assertion succeeds if the dates
are equal. Both dates must be non-null.earlier
- the earlier date to comparelater
- teh later date to comparepublic static void assertNotBefore(java.lang.String msg, java.util.Date earlier, java.util.Date later)
later
is after the date
earlier
. The assertion succeeds if the dates
are equal. Both dates must be non-null.msg
- the message to print if the assertion failsearlier
- the earlier date to comparelater
- the later date to comparepublic static void assertContains(java.lang.String body, java.lang.String fragment)
fragment
is a substring of body
body
- the larger string in which to searchfragment
- the substring that must be contained in body
public static void assertContains(java.lang.String msg, java.lang.String body, java.lang.String fragment)
fragment
is a substring of body
msg
- the message to print if the assertion failsbody
- the larger string in which to searchfragment
- the substring that must be contained in body
public static void disableLocalizationServiceLogging()
public static void enableLocalizationServiceLogging()
protected static void createDirIfNotExists(java.io.File dir)