Commit | Line | Data |
---|---|---|
866e5b51 FC |
1 | package org.eclipse.linuxtools.ctf.core.tests.trace; |
2 | ||
3 | import static org.junit.Assert.assertNotNull; | |
4 | import static org.junit.Assert.assertNull; | |
e5acb357 | 5 | import static org.junit.Assume.assumeTrue; |
866e5b51 FC |
6 | |
7 | import java.nio.ByteOrder; | |
8 | ||
32bf80d2 | 9 | import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces; |
866e5b51 FC |
10 | import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException; |
11 | import org.eclipse.linuxtools.ctf.core.trace.Metadata; | |
12 | import org.junit.After; | |
13 | import org.junit.Before; | |
14 | import org.junit.Test; | |
15 | ||
16 | /** | |
17 | * The class <code>MetadataTest</code> contains tests for the class | |
18 | * <code>{@link Metadata}</code>. | |
e291b8c8 | 19 | * |
866e5b51 FC |
20 | * @author ematkho |
21 | * @version $Revision: 1.0 $ | |
22 | */ | |
be6df2d8 | 23 | @SuppressWarnings("javadoc") |
866e5b51 FC |
24 | public class MetadataTest { |
25 | ||
32bf80d2 AM |
26 | private static final int TRACE_INDEX = 0; |
27 | ||
866e5b51 FC |
28 | private Metadata fixture; |
29 | ||
30 | /** | |
31 | * Launch the test. | |
e291b8c8 | 32 | * |
866e5b51 FC |
33 | * @param args |
34 | * the command line arguments | |
35 | */ | |
36 | public static void main(String[] args) { | |
37 | new org.junit.runner.JUnitCore().run(MetadataTest.class); | |
38 | } | |
39 | ||
40 | /** | |
41 | * Perform pre-test initialization. | |
be6df2d8 AM |
42 | * |
43 | * @throws CTFReaderException | |
866e5b51 FC |
44 | */ |
45 | @Before | |
13be1a8f | 46 | public void setUp() throws CTFReaderException { |
32bf80d2 AM |
47 | assumeTrue(CtfTestTraces.tracesExist()); |
48 | fixture = new Metadata(CtfTestTraces.getTestTrace(TRACE_INDEX)); | |
866e5b51 FC |
49 | } |
50 | ||
51 | /** | |
52 | * Perform post-test clean-up. | |
53 | */ | |
54 | @After | |
55 | public void tearDown() { | |
56 | // Add additional tear down code here | |
57 | } | |
58 | ||
59 | /** | |
60 | * Run the Metadata(CTFTrace) constructor test. | |
61 | */ | |
62 | @Test | |
63 | public void testMetadata() { | |
64 | assertNotNull(fixture); | |
65 | } | |
66 | ||
67 | /** | |
68 | * Run the ByteOrder getDetectedByteOrder() method test. | |
69 | */ | |
70 | @Test | |
71 | public void testGetDetectedByteOrder() { | |
72 | ByteOrder result = fixture.getDetectedByteOrder(); | |
73 | assertNull(result); | |
74 | } | |
75 | ||
e291b8c8 MK |
76 | /** |
77 | * Test toString | |
78 | */ | |
79 | @Test | |
80 | public void testToSting() { | |
81 | String result = fixture.toString(); | |
82 | assertNotNull(result); | |
83 | } | |
84 | ||
866e5b51 FC |
85 | /** |
86 | * Run the void parse() method test. | |
e291b8c8 | 87 | * |
866e5b51 FC |
88 | * @throws CTFReaderException |
89 | */ | |
90 | @Test(expected = org.eclipse.linuxtools.ctf.core.trace.CTFReaderException.class) | |
91 | public void testParse() throws CTFReaderException { | |
92 | fixture.parse(); | |
93 | } | |
94 | } |