diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java index cf62e03792a..4e521d6d28b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/MIMemoryTest.java @@ -12,6 +12,8 @@ *******************************************************************************/ package org.eclipse.cdt.tests.dsf.gdb.tests; +import static org.hamcrest.CoreMatchers.anyOf; +import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; @@ -47,7 +49,6 @@ import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.eclipse.cdt.utils.Addr64; import org.eclipse.debug.core.model.MemoryByte; -import org.hamcrest.CoreMatchers; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -667,8 +668,13 @@ public class MIMemoryTest extends BaseTestCase { fBaseAddress = new Addr64("0"); expectedException.expect(ExecutionException.class); - // Don't test the error message since it changes from one GDB version to another - // TODO: there is another test that does it, we could do it. + String expectedStr1 = "Cannot access memory at address"; + // Error message for new -data-write-memory-bytes command + String expectedStr2 = "Could not write memory"; + expectedException.expect(ExecutionException.class); + expectedException.expectMessage(anyOf( + containsString(expectedStr1), + containsString(expectedStr2))); // Perform the test try { @@ -965,9 +971,9 @@ public class MIMemoryTest extends BaseTestCase { // Error message for new -data-write-memory-bytes command String expectedStr2 = "Could not write memory"; expectedException.expect(ExecutionException.class); - expectedException.expectMessage(CoreMatchers.anyOf( - CoreMatchers.containsString(expectedStr1), - CoreMatchers.containsString(expectedStr2))); + expectedException.expectMessage(anyOf( + containsString(expectedStr1), + containsString(expectedStr2))); // Perform the test try {