| 1 | package org.eclipse.linuxtools.ctf.core.tests.types; |
| 2 | |
| 3 | import static org.junit.Assert.assertNotNull; |
| 4 | |
| 5 | import org.eclipse.linuxtools.ctf.core.event.types.Definition; |
| 6 | import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope; |
| 7 | import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer; |
| 8 | import org.junit.After; |
| 9 | import org.junit.Before; |
| 10 | import org.junit.Test; |
| 11 | |
| 12 | /** |
| 13 | * The class <code>DefinitionTest</code> contains tests for the class |
| 14 | * <code>{@link Definition}</code>. |
| 15 | * |
| 16 | * @author ematkho |
| 17 | * @version $Revision: 1.0 $ |
| 18 | */ |
| 19 | public class DefinitionTest { |
| 20 | |
| 21 | /** |
| 22 | * Launch the test. |
| 23 | * |
| 24 | * @param args |
| 25 | * the command line arguments |
| 26 | */ |
| 27 | public static void main(String[] args) { |
| 28 | new org.junit.runner.JUnitCore().run(DefinitionTest.class); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Perform pre-test initialization. |
| 33 | */ |
| 34 | @Before |
| 35 | public void setUp() { |
| 36 | // add additional set up code here |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Perform post-test clean-up. |
| 41 | */ |
| 42 | @After |
| 43 | public void tearDown() { |
| 44 | // Add additional tear down code here |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Since Definition is abstract, we'll minimally extend it here to |
| 49 | * instantiate it. |
| 50 | */ |
| 51 | class DefTest extends Definition { |
| 52 | |
| 53 | public DefTest(IDefinitionScope definitionScope, String fieldName) { |
| 54 | super(definitionScope, fieldName); |
| 55 | } |
| 56 | |
| 57 | @Override |
| 58 | public void read(BitBuffer input) { |
| 59 | /* Just a test, no need to implement anything */ |
| 60 | } |
| 61 | |
| 62 | } |
| 63 | |
| 64 | @Test |
| 65 | public void testToString() throws Exception { |
| 66 | Definition fixture = new DefTest(null, "Hello"); //$NON-NLS-1$ |
| 67 | String result = fixture.toString(); |
| 68 | |
| 69 | assertNotNull(result); |
| 70 | } |
| 71 | } |