Commit | Line | Data |
---|---|---|
4bd7f2db AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 Ericsson | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Matthew Khouzam - Initial API and implementation | |
10 | *******************************************************************************/ | |
11 | ||
866e5b51 FC |
12 | package org.eclipse.linuxtools.ctf.core.tests.trace; |
13 | ||
14 | import static org.junit.Assert.assertNotNull; | |
15 | import static org.junit.Assert.assertNull; | |
e5acb357 | 16 | import static org.junit.Assume.assumeTrue; |
866e5b51 FC |
17 | |
18 | import java.nio.ByteOrder; | |
19 | ||
32bf80d2 | 20 | import org.eclipse.linuxtools.ctf.core.tests.shared.CtfTestTraces; |
866e5b51 FC |
21 | import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException; |
22 | import org.eclipse.linuxtools.ctf.core.trace.Metadata; | |
866e5b51 FC |
23 | import org.junit.Before; |
24 | import org.junit.Test; | |
25 | ||
26 | /** | |
27 | * The class <code>MetadataTest</code> contains tests for the class | |
28 | * <code>{@link Metadata}</code>. | |
e291b8c8 | 29 | * |
866e5b51 FC |
30 | * @author ematkho |
31 | * @version $Revision: 1.0 $ | |
32 | */ | |
be6df2d8 | 33 | @SuppressWarnings("javadoc") |
866e5b51 FC |
34 | public class MetadataTest { |
35 | ||
32bf80d2 AM |
36 | private static final int TRACE_INDEX = 0; |
37 | ||
866e5b51 FC |
38 | private Metadata fixture; |
39 | ||
866e5b51 FC |
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 | ||
866e5b51 FC |
51 | /** |
52 | * Run the Metadata(CTFTrace) constructor test. | |
53 | */ | |
54 | @Test | |
55 | public void testMetadata() { | |
56 | assertNotNull(fixture); | |
57 | } | |
58 | ||
59 | /** | |
60 | * Run the ByteOrder getDetectedByteOrder() method test. | |
61 | */ | |
62 | @Test | |
63 | public void testGetDetectedByteOrder() { | |
64 | ByteOrder result = fixture.getDetectedByteOrder(); | |
65 | assertNull(result); | |
66 | } | |
67 | ||
e291b8c8 MK |
68 | /** |
69 | * Test toString | |
70 | */ | |
71 | @Test | |
72 | public void testToSting() { | |
73 | String result = fixture.toString(); | |
74 | assertNotNull(result); | |
75 | } | |
76 | ||
866e5b51 FC |
77 | /** |
78 | * Run the void parse() method test. | |
e291b8c8 | 79 | * |
866e5b51 FC |
80 | * @throws CTFReaderException |
81 | */ | |
82 | @Test(expected = org.eclipse.linuxtools.ctf.core.trace.CTFReaderException.class) | |
83 | public void testParse() throws CTFReaderException { | |
84 | fixture.parse(); | |
85 | } | |
86 | } |