Bug 550345 - Add debug code to unstable test

Change-Id: I22bc9eef2124239cc20f067e40bf885c49cfda86
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
index 39eb1e0..9b947e4 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/core/ConsoleTests.java
@@ -295,7 +295,14 @@
 			TestUtil.waitForJobs(getName(), 100, DEFAULT_TIMEOUT); // wait for output appending
 			assertEquals("Test program failed with error.", 0, process.getExitValue());
 			final IDocument consoleDocument = textConsole.getDocument();
-			assertEquals("Wrong number of characters in console.", (numAscii + numUmlaut + 2) * repetitions, consoleDocument.getLength());
+			final int expectedLength = (numAscii + numUmlaut + 2) * repetitions;
+			if (consoleDocument.getLength() > expectedLength) {
+				// debug code for test failures
+				int offset = expectedLength - 20;
+				String trail = consoleDocument.get(offset, consoleDocument.getLength() - offset);
+				System.out.println(trail);
+			}
+			assertEquals("Wrong number of characters in console.", expectedLength, consoleDocument.getLength());
 		} finally {
 			terminateAndRemove(target);
 			debugPrefStore.setValue(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT, true);