Ghidra is a software reverse engineering (SRE) framework
Tests fixes
dragonmacher409954446993
diff --git a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.javaindex 3177ed3612..d7bff8ff89 100644--- a/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java+++ b/Ghidra/Framework/Generic/src/main/java/generic/test/AbstractGenericTest.java@@ -21,7 +21,6 @@ import java.awt.*;import java.awt.image.BufferedImage;import java.io.*;import java.lang.reflect.*;-import java.net.*;import java.nio.file.*;import java.util.*;import java.util.List;@@ -328,18 +327,6 @@ public abstract class AbstractGenericTest extends AbstractGTest {return WindowUtilities.windowForComponent(c);}- public File getLocalResourceFile(String relativePath) {- URL resource = getClass().getResource(relativePath);- try {- URI uri = resource.toURI();- return new File(uri);- }- catch (URISyntaxException e) {- Msg.error(this, "Unable to convert URL to URI", e);- }- return null;- }-/*** Load a text resource file into an ArrayList. Each line of the file is* stored as an item in the list.@@ -355,13 +342,14 @@ public abstract class AbstractGenericTest extends AbstractGTest {if (is == null) {throw new IOException("Could not find resource: " + name);}+ Msg.debug(AbstractGenericTest.class, "Loading classpath resource: " + name);BufferedReader br = new BufferedReader(new InputStreamReader(is));- ArrayList<String> text = readText(br);+ List<String> text = readText(br);br.close();return text;}- private static ArrayList<String> readText(BufferedReader br) throws IOException {+ private static List<String> readText(BufferedReader br) throws IOException {ArrayList<String> list = new ArrayList<>();String line = "";while (line != null) {@@ -374,10 +362,11 @@ public abstract class AbstractGenericTest extends AbstractGTest {}- public static ArrayList<String> loadTextResource(String name) throws IOException {+ public static List<String> loadTextResource(String name) throws IOException {File file = getTestDataFile(name);+ Msg.debug(AbstractGenericTest.class, "Loading text file: " + file);BufferedReader reader = new BufferedReader(new FileReader(file));- ArrayList<String> text = readText(reader);+ List<String> text = readText(reader);reader.close();return text;}@@ -396,6 +385,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {*/public static File getTestDataFile(String path) throws FileNotFoundException {ResourceFile resourceFile = Application.getModuleDataFile("TestResources", path);+ Msg.debug(AbstractGenericTest.class, "Loading test data file: " + resourceFile);return resourceFile.getFile(false);}@@ -429,6 +419,7 @@ public abstract class AbstractGenericTest extends AbstractGTest {public static File findTestDataFile(String path) {try {ResourceFile resourceFile = Application.getModuleDataFile("TestResources", path);+ Msg.debug(AbstractGenericTest.class, "Loading test data file: " + resourceFile);return resourceFile.getFile(false);}catch (FileNotFoundException e) {@@ -809,10 +800,10 @@ public abstract class AbstractGenericTest extends AbstractGTest {}/**- * Creates a file in the Java temp directory using the given name as a+ * Creates a file in the Application temp directory using the given name as a* prefix and the given suffix. The final filename will also include the* current test name, as well as any data added by- * {@link File#createTempFile(String, String)}. The file suffix will be+ * {@link File#createTempFile(String, String, File)}. The file suffix will be* <code>.tmp</code>* <p>* The file will be marked to delete on JVM exit. This will not work if the@@ -830,10 +821,10 @@ public abstract class AbstractGenericTest extends AbstractGTest {}/**- * Creates a file in the Java temp directory using the given name as a+ * Creates a file in the Application temp directory using the given name as a* prefix and the given suffix. The final filename will also include the* current test name, as well as any data added by- * {@link File#createTempFile(String, String)}.+ * {@link File#createTempFile(String, String, File)}.* <p>* The file will be marked to delete on JVM exit. This will not work if the* JVM is taken down the hard way, as when pressing the stop button indiff --git a/Ghidra/Framework/Gui/src/test/java/ghidra/util/HTMLUtilitiesTest.java b/Ghidra/Framework/Gui/src/test/java/ghidra/util/HTMLUtilitiesTest.javaindex 81c2be8b3d..8cc9f937ca 100644--- a/Ghidra/Framework/Gui/src/test/java/ghidra/util/HTMLUtilitiesTest.java+++ b/Ghidra/Framework/Gui/src/test/java/ghidra/util/HTMLUtilitiesTest.java@@ -43,12 +43,12 @@ public class HTMLUtilitiesTest {public void testToHTML_WithNewlinesOnly() {String s = "This text has\na newline character";String html = HTMLUtilities.toHTML(s);- assertEquals(HTML + "This text has<BR>\na newline character", html);+ assertEquals(HTML + "This text has<br>\na newline character", html);}@Testpublic void testToHTML_WithBrTagsOnly() {- String s = "This text has<BR>an existing BR tag";+ String s = "This text has<br>an existing BR tag";String html = HTMLUtilities.toHTML(s);assertEquals(HTML + s, html);spyLogger.assertLogMessage("cannot", "wrap");@@ -56,7 +56,7 @@ public class HTMLUtilitiesTest {@Testpublic void testToHTML_WithNewlinesAndBrTags() {- String s = "This text has<BR>\nan existing BR tag and a newline";+ String s = "This text has<br>\nan existing BR tag and a newline";String html = HTMLUtilities.toHTML(s);assertEquals(HTML + s, html);spyLogger.assertLogMessage("cannot", "wrap");@@ -68,7 +68,7 @@ public class HTMLUtilitiesTest {"This is a line that is longer than the default line limit of seventy-five characters";String html = HTMLUtilities.toWrappedHTML(s);assertEquals(HTML +- "This is a line that is longer than the default line limit of seventy-five<BR>\n" ++ "This is a line that is longer than the default line limit of seventy-five<br>\n" +"characters", html);}@@ -77,14 +77,14 @@ public class HTMLUtilitiesTest {// note: toWrappedHTML preserves whitespaceString s = "Wrap\n\nhere\n\n\n";String html = HTMLUtilities.toWrappedHTML(s, 0);- assertEquals(HTML + "Wrap<BR>\n<BR>\nhere<BR>\n<BR>\n<BR>\n", html);+ assertEquals(HTML + "Wrap<br>\n<br>\nhere<br>\n<br>\n<br>\n", html);}@Testpublic void testToWrappedHTML_SpecifiedWrapLimit() {String s = "Wrap here";String html = HTMLUtilities.toWrappedHTML(s, 4);- assertEquals(HTML + "Wrap<BR>\nhere", html);+ assertEquals(HTML + "Wrap<br>\nhere", html);}@Test@@ -107,16 +107,16 @@ public class HTMLUtilitiesTest {@Testpublic void testToLiteralHTML_AlreadyStartingWithHTML() {- String s = "<html>Wrap<BR>here";+ String s = "<html>Wrap<br>here";String html = HTMLUtilities.toLiteralHTML(s, 4);- assertEquals(HTML + "<HTM<BR>\nL>Wr<BR>\nap<B<BR>\nR>he<BR>\nre", html);+ assertEquals(HTML + "<htm<br>\nl>Wr<br>\nap<b<br>\nr>he<br>\nre", html);}@Testpublic void testToLiteralHTML_NoExisingHTML_SpecifiedLimit() {String s = "Wrap here";String html = HTMLUtilities.toLiteralHTML(s, 4);- assertEquals(HTML + "Wrap<BR>\n <BR>\nhere", html);+ assertEquals(HTML + "Wrap<br>\n <br>\nhere", html);}@Test@@ -143,7 +143,7 @@ public class HTMLUtilitiesTest {String placeholderStr =HTMLUtilities.wrapWithLinkPlaceholder("Stuff inside link tag", "targetstr");String htmlStr = HTMLUtilities.convertLinkPlaceholdersToHyperlinks(placeholderStr);- assertEquals("<A HREF=\"targetstr\">Stuff inside link tag</A>", htmlStr);+ assertEquals("<a href=\"targetstr\">Stuff inside link tag</a>", htmlStr);}@Test@@ -151,7 +151,7 @@ public class HTMLUtilitiesTest {String placeholderStr =HTMLUtilities.wrapWithLinkPlaceholder("Stuff inside link tag", "test$1");String htmlStr = HTMLUtilities.convertLinkPlaceholdersToHyperlinks(placeholderStr);- assertEquals("<A HREF=\"test$1\">Stuff inside link tag</A>", htmlStr);+ assertEquals("<a href=\"test$1\">Stuff inside link tag</a>", htmlStr);}@Test@@ -159,7 +159,7 @@ public class HTMLUtilitiesTest {String placeholderStr =HTMLUtilities.wrapWithLinkPlaceholder("Stuff inside <b>link</b> tag", "test");String htmlStr = HTMLUtilities.convertLinkPlaceholdersToHyperlinks(placeholderStr);- assertEquals("<A HREF=\"test\">Stuff inside <b>link</b> tag</A>", htmlStr);+ assertEquals("<a href=\"test\">Stuff inside <b>link</b> tag</a>", htmlStr);}@Test