diff options
author | Andrew Johnson | 2023-05-18 07:54:47 +0000 |
---|---|---|
committer | Andrew Johnson | 2023-05-18 07:54:47 +0000 |
commit | 7fab3e77172386a8123065d8b2dc1d07d3ad4a97 (patch) | |
tree | 0d756c82c029423ae45934c5d99f5eeeff5e1e01 | |
parent | b9d2cbe63db5c1b35228977c7511fc2f3c483fee (diff) | |
download | org.eclipse.mat-7fab3e77172386a8123065d8b2dc1d07d3ad4a97.tar.gz org.eclipse.mat-7fab3e77172386a8123065d8b2dc1d07d3ad4a97.tar.xz org.eclipse.mat-7fab3e77172386a8123065d8b2dc1d07d3ad4a97.zip |
Bug 581829 - Do not show primitive values for PHD dumps
Fix test, and some other test tidy up.
Change-Id: Ic855fb4b1c325f63edfead23758a1a5ffc516dbd
5 files changed, 28 insertions, 28 deletions
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/acquire/AcquireDumpTest.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/acquire/AcquireDumpTest.java index 0d0ee081..85cf9674 100644 --- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/acquire/AcquireDumpTest.java +++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/acquire/AcquireDumpTest.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2015, 2021 IBM Corporation.
+ * Copyright (c) 2015, 2023 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -15,9 +15,9 @@ package org.eclipse.mat.tests.acquire; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.number.OrderingComparison.greaterThan;
import static org.hamcrest.number.OrderingComparison.greaterThanOrEqualTo;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeThat;
@@ -366,8 +366,8 @@ public class AcquireDumpTest }
}
}
- assertEquals("Expected to find a org.eclipse.mat.tests plugin", found, 1);
- assertEquals("Expected Dependencies,Dependents, Extension Points, Extensions, Used Services from org.eclipse.mat.api", f2, 31);
+ assertThat("Expected to find a org.eclipse.mat.tests plugin", found, equalTo(1));
+ assertThat("Expected Dependencies,Dependents, Extension Points, Extensions, Used Services from org.eclipse.mat.api", f2, equalTo(31));
}
private void checkSubtree(IResultTree tree, Object o3, int minElements, String toFind, String errMsg)
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayIntTest.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayIntTest.java index aa932249..74e68730 100644 --- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayIntTest.java +++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayIntTest.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2010, 2022 IBM Corporation
+ * Copyright (c) 2010, 2023 IBM Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,9 +14,8 @@ package org.eclipse.mat.tests.collect; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.number.OrderingComparison.greaterThan;
import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -57,8 +56,8 @@ public class ArrayIntTest ss.add(v);
t += 1;
}
- assertTrue("At least one item should have been added", t > 0); //$NON-NLS-1$
- assertEquals("Added items should equal size", t, ss.size()); //$NON-NLS-1$
+ assertThat("At least one item should have been added", t, greaterThan(0)); //$NON-NLS-1$
+ assertThat("Size should equal added items", ss.size(), equalTo(t)); //$NON-NLS-1$
assertFalse("Not empty", ss.isEmpty());
}
}
@@ -84,7 +83,7 @@ public class ArrayIntTest }
int i = 0;
for (IteratorInt ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every entry should be in the iterator", ss.get(i++), ii.next()); //$NON-NLS-1$
+ assertThat("the iterator should match each entry", ii.next(), equalTo(ss.get(i++))); //$NON-NLS-1$
}
}
@@ -110,7 +109,7 @@ public class ArrayIntTest for (int k = 0; k < KEYS; ++k) {
t += ss.get(k) > 0 ? 1 : 0;
}
- assertEquals("contained items should equals the size", ss.size(), t); //$NON-NLS-1$
+ assertThat("contained items should equals the size", t, equalTo(ss.size())); //$NON-NLS-1$
}
/**
@@ -134,7 +133,7 @@ public class ArrayIntTest ArrayInt ss2 = new ArrayInt(ss);
int i = 0;
for (IteratorInt ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every entry should be in the iterator", ss2.get(i++), ii.next()); //$NON-NLS-1$
+ assertThat("the iterator should match each entry", ii.next(), equalTo(ss2.get(i++))); //$NON-NLS-1$
}
}
@@ -254,11 +253,11 @@ public class ArrayIntTest }
int i = 0;
for (IteratorInt ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every key should be contained in the deserialized version", ii.next(), ss2.get(i++)); //$NON-NLS-1$
+ assertThat("every key should be contained in the deserialized version", ii.next(), equalTo(ss2.get(i++))); //$NON-NLS-1$
}
i = 0;
for (IteratorInt ii = ss2.iterator(); ii.hasNext(); ){
- assertEquals("every deserialized key should be contained", ii.next(), ss.get(i++)); //$NON-NLS-1$
+ assertThat("every deserialized key should be contained", ii.next(), equalTo(ss.get(i++))); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayLongTest.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayLongTest.java index 96a60624..bb401ae5 100644 --- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayLongTest.java +++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/collect/ArrayLongTest.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2010, 2022 IBM Corporation
+ * Copyright (c) 2010, 2023 IBM Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,8 @@ package org.eclipse.mat.tests.collect; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.number.OrderingComparison.greaterThan;
import static org.hamcrest.number.OrderingComparison.lessThanOrEqualTo;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -57,12 +57,12 @@ public class ArrayLongTest ss.add(v);
t += 1;
}
- assertTrue("At least one item should have been added", t > 0); //$NON-NLS-1$
- assertEquals("Added items should equal size", t, ss.size()); //$NON-NLS-1$
- assertFalse("Not empty", ss.isEmpty());
+ assertThat("At least one item should have been added", t, greaterThan(0)); //$NON-NLS-1$
+ assertThat("Size should equal added items", ss.size(), equalTo(t)); //$NON-NLS-1$
+ assertFalse("Not empty", ss.isEmpty()); //$NON-NLS-1$
}
}
-
+
/**
* Check that set contains everything it says it has
*/
@@ -84,7 +84,7 @@ public class ArrayLongTest }
int i = 0;
for (IteratorLong ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every entry should be in the iterator", ss.get(i++), ii.next()); //$NON-NLS-1$
+ assertThat("the iterator should match each entry", ii.next(), equalTo(ss.get(i++))); //$NON-NLS-1$
}
}
@@ -113,7 +113,7 @@ public class ArrayLongTest for (int k = 0; k < KEYS; ++k) {
t += ss.get(k) != 0 ? 1 : 0;
}
- assertEquals("contained items should equals the size", ss.size(), t); //$NON-NLS-1$
+ assertThat("contained items should equals the size", t, equalTo(ss.size())); //$NON-NLS-1$
}
/**
@@ -137,7 +137,7 @@ public class ArrayLongTest ArrayLong ss2 = new ArrayLong(ss);
int i = 0;
for (IteratorLong ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every entry should be in the iterator", ss2.get(i++), ii.next()); //$NON-NLS-1$
+ assertThat("the iterator should match each entry", ii.next(), equalTo(ss2.get(i++))); //$NON-NLS-1$
}
}
@@ -260,11 +260,11 @@ public class ArrayLongTest }
int i = 0;
for (IteratorLong ii = ss.iterator(); ii.hasNext(); ){
- assertEquals("every key should be contained in the deserialized version", ii.next(), ss2.get(i++)); //$NON-NLS-1$
+ assertThat("every key should be contained in the deserialized version", ii.next(), equalTo(ss2.get(i++))); //$NON-NLS-1$
}
i = 0;
for (IteratorLong ii = ss2.iterator(); ii.hasNext(); ){
- assertEquals("every deserialized key should be contained", ii.next(), ss.get(i++)); //$NON-NLS-1$
+ assertThat("every deserialized key should be contained", ii.next(), equalTo(ss.get(i++))); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java index 3dfb1273..95121f32 100644 --- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java +++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/GeneralSnapshotTests.java @@ -1307,7 +1307,8 @@ public class GeneralSnapshotTests assertNotNull(t);
// Will run name resolvers on every object!
IResultTable table = (IResultTable)t;
- // Every PHD files have some empty char arrays which get resolved.
+ // PHD files do have char arrays and byte arrays, but these no longer get resolved (bug 581829).
+ assumeThat(snapshot.getSnapshotInfo().getProperty("$heapFormat"), not(equalTo((Serializable)"DTFJ-PHD")));
assumeThat(snapshot.getSnapshotInfo().getProperty("$heapFormat"), not(equalTo((Serializable)"DTFJ-Javacore")));
// More than one different line, so some name resolvers are working
assertThat(table.getRowCount(), greaterThan(1));
diff --git a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueryLookupTest.java b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueryLookupTest.java index 00383938..0b7cf887 100644 --- a/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueryLookupTest.java +++ b/plugins/org.eclipse.mat.tests/src/org/eclipse/mat/tests/snapshot/QueryLookupTest.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2010, 2022 SAP AG and IBM Corporation
+ * Copyright (c) 2010, 2023 SAP AG and IBM Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -752,7 +752,7 @@ public class QueryLookupTest * without conversion.
*/
if (v < limit && v >= -limit || !s.contains("\u2248"))
- assertTrue(colIdx+":"+c.getLabel()+" "+f.toString() +" " + vc + "\n" + v + "\n" + d2 + "\n" + s + "\n" + s2, s2.matches("[+-]?[0-9,]+(\\.[0-9]+)?(\\s?%)?"));
+ assertTrue(colIdx+":"+c.getLabel()+" "+f.toString() +" " + vc + "\n" + v + "\n" + d2 + "\n" + s + "\n" + s2, s2.matches("[+-]?[0-9,]+(\\.[0-9]{1,20})?(\\s?%)?"));
}
}
}
|