public abstract class AbstractTestClass
extends java.lang.Object
startAsyncTest()
, we acquire a Semaphore
, which locks the thread. You must
also remember to call succeed()
, again when calling startAsyncTest()
to release the semaphore.startAsyncTest()
,
startSynchronousTest()
,
succeed()
Constructor and Description |
---|
AbstractTestClass() |
Modifier and Type | Method and Description |
---|---|
void |
assertArrayEquals(byte[] expected,
byte[] actual)
Forwards
Assert.assertArrayEquals(byte[], byte[]) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertArrayEquals(java.lang.String msg,
byte[] expected,
byte[] actual)
Forwards
Assert.assertArrayEquals(String, byte[], byte[]) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(double expected,
double actual,
double delta)
Forwards
Assert.assertEquals(double, double, double) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(long expected,
long actual)
Forwards
Assert.assertEquals(long, long) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(java.lang.String failMsg,
double expected,
double actual,
double delta)
Forwards
Assert.assertEquals(String, double, double, double) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(java.lang.String failMsg,
long expected,
long actual)
Forwards
Assert.assertEquals(String, long, long) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(java.lang.String expected,
java.lang.String actual)
Forwards
Assert.assertEquals(Object, Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertEquals(java.lang.String failMsg,
java.lang.String expected,
java.lang.String actual)
Forwards
Assert.assertEquals(String, Object, Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertFalse(boolean condition)
Forwards
Assert.assertFalse(boolean) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertFalse(java.lang.String msg,
boolean condition)
Forwards
Assert.assertFalse(String, boolean) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertNotNull(java.lang.Object object)
Forwards
Assert.assertNotNull(Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertNotNull(java.lang.String msg,
java.lang.Object object)
Forwards
Assert.assertNotNull(String, Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertNull(java.lang.Object object)
Forwards
Assert.assertNull(Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertNull(java.lang.String msg,
java.lang.Object object)
Forwards
Assert.assertNull(String, Object) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
<T> void |
assertThat(java.lang.String failMessage,
T actual,
org.hamcrest.Matcher<? super T> matcher)
Forwards
Assert.assertThat(String, Object, Matcher) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
<T> void |
assertThat(T actual,
org.hamcrest.Matcher<? super T> matcher)
Forwards
Assert.assertThat(Object, Matcher) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertTrue(boolean condition)
Forwards
Assert.assertTrue(boolean) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
assertTrue(java.lang.String msg,
boolean condition)
Forwards
Assert.assertTrue(String, boolean) , and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up). |
void |
reacquire()
This will re-acquire the semaphore to lock the current thread.
|
void |
release()
Releases the semaphore, if it's being held.
|
void |
startAsyncTest()
Call this method if the test is asynchronous.
|
void |
startSynchronousTest()
Call this method if the test is synchronous.
|
void |
succeed()
Releases the semphore held by this class (if applicable), and prints a message to the console about the test completing successfully.
|
public void startSynchronousTest() throws java.lang.Exception
succeed()
when the test is
done, but it's not necessary for the test to complete.java.lang.Exception
public void startAsyncTest() throws java.lang.Exception
Semaphore
.
You then need to call succeed()
to, well, succeed the test. Otherwise, you should be using any of the assert methods in this class
to catch errors (and will throw exceptions if there are -- and properly kill the test if this is the case)java.lang.Exception
public void reacquire() throws java.lang.Exception
java.lang.Exception
public void release()
succeed()
, unless you are doing
something that requires re-aquiring the semaphore.public void succeed()
public void assertTrue(boolean condition)
Assert.assertTrue(boolean)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertTrue(java.lang.String msg, boolean condition)
Assert.assertTrue(String, boolean)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertFalse(boolean condition)
Assert.assertFalse(boolean)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertFalse(java.lang.String msg, boolean condition)
Assert.assertFalse(String, boolean)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertNotNull(java.lang.Object object)
Assert.assertNotNull(Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertNotNull(java.lang.String msg, java.lang.Object object)
Assert.assertNotNull(String, Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertNull(java.lang.Object object)
Assert.assertNull(Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertNull(java.lang.String msg, java.lang.Object object)
Assert.assertNull(String, Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(long expected, long actual)
Assert.assertEquals(long, long)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(java.lang.String failMsg, long expected, long actual)
Assert.assertEquals(String, long, long)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(double expected, double actual, double delta)
Assert.assertEquals(double, double, double)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(java.lang.String failMsg, double expected, double actual, double delta)
Assert.assertEquals(String, double, double, double)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(java.lang.String expected, java.lang.String actual)
Assert.assertEquals(Object, Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertEquals(java.lang.String failMsg, java.lang.String expected, java.lang.String actual)
Assert.assertEquals(String, Object, Object)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertArrayEquals(byte[] expected, byte[] actual)
Assert.assertArrayEquals(byte[], byte[])
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public void assertArrayEquals(java.lang.String msg, byte[] expected, byte[] actual)
Assert.assertArrayEquals(String, byte[], byte[])
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public <T> void assertThat(T actual, org.hamcrest.Matcher<? super T> matcher)
Assert.assertThat(Object, Matcher)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).public <T> void assertThat(java.lang.String failMessage, T actual, org.hamcrest.Matcher<? super T> matcher)
Assert.assertThat(String, Object, Matcher)
, and wraps it in a try/catch so that we can properly release the semaphore when a test
fails (so it doesn't lock up).