Update for Bug287562 (Event Model code refresh + JUnits)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.tests / src / org / eclipse / linuxtools / tmf / event / TmfEventContentTest.java
1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.tmf.event;
14
15 import static org.junit.Assert.assertEquals;
16
17 import org.junit.Test;
18
19 /**
20 * <b><u>TmfEventContentTest</u></b>
21 * <p>
22 * JUnit test suite for the TmfEventContent class.
23 */
24 public class TmfEventContentTest {
25
26 // ========================================================================
27 // Constructors
28 // ========================================================================
29
30 @Test
31 public void testTmfEventContent() {
32 TmfEventContent content = new TmfEventContent("Some content", new TmfEventFormat());
33 assertEquals("getFormat", 1, content.getFormat().getLabels().length);
34 assertEquals("getLabels", "Content", content.getFormat().getLabels()[0]);
35 assertEquals("getContent", "Some content", content.getContent());
36 }
37
38 // ========================================================================
39 // getField
40 // ========================================================================
41
42 @Test
43 public void testBasicGetField() {
44 TmfEventContent content = new TmfEventContent("Some content", new TmfEventFormat());
45 assertEquals("getField", 1, content.getFields().length);
46 assertEquals("getField", "Some content", content.getField(0).toString());
47 }
48
49 @Test
50 public void testExtendedGetField() {
51 TmfEventContent content = new TmfEventContent("", new TmfEventFormatStub());
52 assertEquals("getField", 5, content.getFields().length);
53 assertEquals("getField", "1", content.getField(0).toString());
54 assertEquals("getField", "-10", content.getField(1).toString());
55 assertEquals("getField", "true", content.getField(2).toString());
56 assertEquals("getField", "some string", content.getField(3).toString());
57 assertEquals("getField", "[TmfTimestamp:1,2,3]", content.getField(4).toString());
58 }
59
60 }
This page took 0.031627 seconds and 5 git commands to generate.