GP-1196 - add @Rule to AbstractGTest

This commit is contained in:
ghizard
2021-08-10 14:45:11 -04:00
parent fe6006c300
commit 5fb65d845f
@@ -15,7 +15,8 @@
*/ */
package generic.test; package generic.test;
import static org.junit.Assert.*; import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@@ -26,6 +27,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Rule;
import org.junit.rules.TestName; import org.junit.rules.TestName;
import ghidra.framework.Application; import ghidra.framework.Application;
@@ -37,10 +39,10 @@ import junit.framework.AssertionFailedError;
/** /**
* A root for system tests that provides known system information. * A root for system tests that provides known system information.
* *
* <P>This class exists so that fast unit tests have a place to share data without having the * <P>This class exists so that fast unit tests have a place to share data without having the
* slowness of more heavy weight concepts like {@link Application}, logging, etc. * slowness of more heavy weight concepts like {@link Application}, logging, etc.
* *
* <P> !! WARNING !! * <P> !! WARNING !!
* This test is meant to initialize quickly. All file I/O should be avoided. * This test is meant to initialize quickly. All file I/O should be avoided.
*/ */
@@ -68,6 +70,7 @@ public abstract class AbstractGTest {
private static String testDirectoryPath = createTestDirectoryPath(); private static String testDirectoryPath = createTestDirectoryPath();
@Rule
public TestName testName = new TestName(); public TestName testName = new TestName();
/** /**
@@ -318,7 +321,7 @@ public abstract class AbstractGTest {
/** /**
* Returns the current test method name * Returns the current test method name
* *
* @return the current test method name * @return the current test method name
*/ */
public String getName() { public String getName() {
@@ -327,7 +330,7 @@ public abstract class AbstractGTest {
/** /**
* Friendly way to create an array of bytes with static values. * Friendly way to create an array of bytes with static values.
* *
* @param unsignedBytes var-args list of unsigned byte values (ie. 0..255) * @param unsignedBytes var-args list of unsigned byte values (ie. 0..255)
* @return array of bytes * @return array of bytes
*/ */
@@ -339,7 +342,6 @@ public abstract class AbstractGTest {
return result; return result;
} }
//================================================================================================== //==================================================================================================
// Wait Methods // Wait Methods
//================================================================================================== //==================================================================================================
@@ -360,7 +362,7 @@ public abstract class AbstractGTest {
/** /**
* Waits for the given latch to be counted-down * Waits for the given latch to be counted-down
* *
* @param latch the latch to await * @param latch the latch to await
* @throws AssertionFailedError if the condition is not met within the timeout period * @throws AssertionFailedError if the condition is not met within the timeout period
*/ */
@@ -376,7 +378,7 @@ public abstract class AbstractGTest {
} }
/** /**
* Waits for the given AtomicBoolean to return true. This is a convenience method for * Waits for the given AtomicBoolean to return true. This is a convenience method for
* {@link #waitFor(BooleanSupplier)}. * {@link #waitFor(BooleanSupplier)}.
* *
* @param ab the atomic boolean * @param ab the atomic boolean
@@ -564,5 +566,5 @@ public abstract class AbstractGTest {
//================================================================================================== //==================================================================================================
// End Wait Methods // End Wait Methods
//================================================================================================== //==================================================================================================
} }