From 7328220fe6601dd1b70e9f2384096c71d3e3fca0 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 19 Feb 2015 11:46:17 -0500 Subject: [PATCH] [dsf-gdb] Add expected message in MIMemoryTest.writeWithInvalidAddress Change-Id: Id1f46c879669e3a428bbc8039ff6363be35a9cb6 Signed-off-by: Simon Marchi --- .../cdt/tests/dsf/gdb/tests/MIMemoryTest.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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 {