Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1196 - add @Rule to AbstractGTest

ghizard5fb65d845f8d
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGTest.java b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGTest.java
index 1ed6cf4501..6dd9e43a2b 100644
--- a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGTest.java
+++ b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGTest.java
@@ -15,7 +15,8 @@
*/
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.util.*;
@@ -26,6 +27,7 @@ import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import org.junit.Assert;
+import org.junit.Rule;
import org.junit.rules.TestName;
import ghidra.framework.Application;
@@ -37,10 +39,10 @@ import junit.framework.AssertionFailedError;
/**
* 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
* slowness of more heavy weight concepts like {@link Application}, logging, etc.
- *
+ *
* <P> !! WARNING !!
* 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();
+ @Rule
public TestName testName = new TestName();
/**
@@ -318,7 +321,7 @@ public abstract class AbstractGTest {
/**
* Returns the current test method name
- *
+ *
* @return the current test method name
*/
public String getName() {
@@ -327,7 +330,7 @@ public abstract class AbstractGTest {
/**
* Friendly way to create an array of bytes with static values.
- *
+ *
* @param unsignedBytes var-args list of unsigned byte values (ie. 0..255)
* @return array of bytes
*/
@@ -339,7 +342,6 @@ public abstract class AbstractGTest {
return result;
}
-
//==================================================================================================
// Wait Methods
//==================================================================================================
@@ -360,7 +362,7 @@ public abstract class AbstractGTest {
/**
* Waits for the given latch to be counted-down
- *
+ *
* @param latch the latch to await
* @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)}.
*
* @param ab the atomic boolean
@@ -564,5 +566,5 @@ public abstract class AbstractGTest {
//==================================================================================================
// End Wait Methods
-//==================================================================================================
+//==================================================================================================
}