Test timing debugging

This commit is contained in:
dragonmacher
2020-03-17 15:40:14 -04:00
parent 53912fe9b1
commit 1a6395b767
3 changed files with 16 additions and 6 deletions
@@ -513,7 +513,9 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
listingHoverHandler.initializeListingHoverHandler(handler);
listingHoverHandler.dispose();
}
listingHoverHandler = handler;
fieldPanel.setHoverProvider(listingHoverHandler);
}
public void dispose() {
@@ -807,20 +807,23 @@ public class FunctionGraphPlugin1Test extends AbstractFunctionGraphTest {
assertInHistory(Arrays.asList(addresses));
}
private void assertInHistory(List<Address> addresses) {
private void assertInHistory(List<Address> expectedAddresses) {
List<LocationMemento> locations = getNavigationHistory();
assertTrue("Vertex locations not added to history", addresses.size() <= locations.size());
List<LocationMemento> actualLocations = getNavigationHistory();
assertTrue(
"Vertex address should be in the history list: " + expectedAddresses + ".\nHistory: " +
actualLocations + "\nNavigated vertices: " + expectedAddresses,
expectedAddresses.size() <= actualLocations.size());
List<Address> actualAddresses =
locations.stream()
actualLocations.stream()
.map(memento -> memento.getProgramLocation().getAddress())
.collect(Collectors.toList());
for (Address a : addresses) {
for (Address a : expectedAddresses) {
assertTrue("Vertex address should be in the history list: " + a + ".\nHistory: " +
actualAddresses + "\nNavigated vertices: " + addresses,
actualAddresses + "\nNavigated vertices: " + expectedAddresses,
actualAddresses.contains(a));
}
}
@@ -57,6 +57,11 @@ public class SpyEventRecorder {
}
}
// synchronized because we spy on multiple threads (like Test and Swing)
public synchronized void record(String message, Object... args) {
record(String.format(message, args));
}
private synchronized String eventsToString() {
int size = events.size();