Commit | Line | Data |
---|---|---|
866e5b51 FC |
1 | package org.eclipse.linuxtools.ctf.core.tests.trace; |
2 | ||
3 | import static org.junit.Assert.assertEquals; | |
4 | import static org.junit.Assert.assertNotNull; | |
5 | ||
ce2388e0 | 6 | import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndexEntry; |
866e5b51 FC |
7 | import org.junit.After; |
8 | import org.junit.Before; | |
9 | import org.junit.Test; | |
10 | ||
11 | /** | |
12 | * The class <code>StreamInputPacketIndexEntryTest</code> contains tests for the | |
13 | * class <code>{@link StreamInputPacketIndexEntry}</code>. | |
ce2388e0 | 14 | * |
866e5b51 FC |
15 | * @author ematkho |
16 | * @version $Revision: 1.0 $ | |
17 | */ | |
18 | public class StreamInputPacketIndexEntryTest { | |
19 | ||
20 | private StreamInputPacketIndexEntry fixture; | |
21 | ||
22 | /** | |
23 | * Launch the test. | |
ce2388e0 | 24 | * |
866e5b51 FC |
25 | * @param args |
26 | * the command line arguments | |
27 | */ | |
28 | public static void main(String[] args) { | |
29 | new org.junit.runner.JUnitCore().run(StreamInputPacketIndexEntryTest.class); | |
30 | } | |
31 | ||
32 | /** | |
33 | * Perform pre-test initialization. | |
34 | */ | |
35 | @Before | |
36 | public void setUp() { | |
37 | fixture = new StreamInputPacketIndexEntry(1L); | |
38 | } | |
39 | ||
40 | /** | |
41 | * Perform post-test clean-up. | |
42 | */ | |
43 | @After | |
44 | public void tearDown() { | |
45 | // Add additional tear down code here | |
46 | } | |
47 | ||
48 | /** | |
49 | * Run the StreamInputPacketIndexEntry(long) constructor test. | |
50 | */ | |
51 | @Test | |
52 | public void testStreamInputPacketIndexEntry_1() { | |
ce2388e0 | 53 | String expectedResult = "StreamInputPacketIndexEntry [offsetBytes=1, " + //$NON-NLS-1$ |
bfe038ff | 54 | "timestampBegin=0, timestampEnd=0]"; //$NON-NLS-1$ |
866e5b51 FC |
55 | |
56 | assertNotNull(fixture); | |
57 | assertEquals(expectedResult, fixture.toString()); | |
58 | } | |
59 | ||
60 | /** | |
61 | * Run the String toString() method test. | |
62 | */ | |
63 | @Test | |
64 | public void testToString() { | |
ce2388e0 | 65 | String expectedResult = "StreamInputPacketIndexEntry [offsetBytes=1,"+ //$NON-NLS-1$ |
bfe038ff MK |
66 | " timestampBegin=1, timestampEnd=1]"; //$NON-NLS-1$ |
67 | ||
866e5b51 | 68 | |
ce2388e0 FC |
69 | fixture.setContentSizeBits(1); |
70 | fixture.setDataOffsetBits(1); | |
71 | fixture.setTimestampEnd(1L); | |
72 | fixture.setPacketSizeBits(1); | |
73 | fixture.setTimestampBegin(1L); | |
866e5b51 FC |
74 | |
75 | assertEquals(expectedResult, fixture.toString()); | |
76 | } | |
77 | } |