Skip to content

Commit 1f5767a

Browse files
committed
OQL test - do not rely on toString() implementation of Map
1 parent f17a8c5 commit 1f5767a

File tree

1 file changed

+15
-2
lines changed
  • visualvm/libs.profiler/profiler.oql/test/unit/src/org/graalvm/visualvm/lib/profiler/oql/engine/api/impl

1 file changed

+15
-2
lines changed

visualvm/libs.profiler/profiler.oql/test/unit/src/org/graalvm/visualvm/lib/profiler/oql/engine/api/impl/OQLEngineTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,11 +683,11 @@ public void testComplexStatement2() throws Exception {
683683

684684
public boolean visit(Object o) {
685685
System.out.println(o);
686-
rslt[0] = o.toString();
686+
rslt[0] = dump(o);
687687
return true;
688688
}
689689
});
690-
assertEquals("{value=, key=sun.cpu.isalist}", rslt[0]);
690+
assertEquals("{key=sun.cpu.isalist, value=}", rslt[0]);
691691
}
692692

693693
@Test
@@ -745,4 +745,17 @@ public boolean visit(Object o) {
745745
}
746746
});
747747
}
748+
749+
private String dump(Object o) {
750+
if (o instanceof Map) {
751+
List<String> els = new ArrayList<>();
752+
Map<?,?> m = (Map) o;
753+
for (Map.Entry e : m.entrySet()) {
754+
els.add(e.getKey()+"="+e.getValue());
755+
}
756+
els.sort(null);
757+
return "{"+String.join(", ", els)+"}";
758+
}
759+
return o.toString();
760+
}
748761
}

0 commit comments

Comments
 (0)