mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-18 13:45:45 +02:00
Reworked awkward junit assertion flow (have seen this in various places)
This commit is contained in:
parent
9c26a6933c
commit
0a695a3e81
1 changed files with 10 additions and 12 deletions
|
@ -14,7 +14,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -172,16 +171,15 @@ public class GDBProcessesTest extends BaseTestCase {
|
||||||
assertTrue(fWait.getMessage(), fWait.isOK());
|
assertTrue(fWait.getMessage(), fWait.isOK());
|
||||||
|
|
||||||
IThreadDMData threadData = (IThreadDMData)fWait.getReturnInfo();
|
IThreadDMData threadData = (IThreadDMData)fWait.getReturnInfo();
|
||||||
if(threadData == null)
|
Assert.assertNotNull("Thread data not returned for thread id = " + THREAD_ID, threadData);
|
||||||
fail("Thread data not returned for thread id = " + THREAD_ID);
|
|
||||||
else{
|
// Thread id is only a series of numbers
|
||||||
// Thread id is only a series of numbers
|
Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); //$NON-NLS-1$
|
||||||
Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); //$NON-NLS-1$
|
Matcher matcher = pattern.matcher(threadData.getId());
|
||||||
Matcher matcher = pattern.matcher(threadData.getId());
|
assertTrue("Thread ID is a series of number", matcher.find());
|
||||||
assertTrue("Thread ID is a series of number", matcher.find());
|
// Name is blank in case of GDB back end
|
||||||
// Name is blank in case of GDB back end
|
assertEquals("Thread name is should have been blank for GDB Back end", "", threadData.getName());
|
||||||
assertEquals("Thread name is should have been blank for GDB Back end", "", threadData.getName());
|
|
||||||
}
|
fWait.waitReset();
|
||||||
fWait.waitReset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue