ctf: Disable NLS warnings in test plugin
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / EnumDeclarationTest.java
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
12 package org.eclipse.linuxtools.ctf.core.tests.types;
13
14 import static org.junit.Assert.assertEquals;
15 import static org.junit.Assert.assertNotNull;
16 import static org.junit.Assert.assertNull;
17 import static org.junit.Assert.assertTrue;
18
19 import java.nio.ByteOrder;
20
21 import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
22 import org.eclipse.linuxtools.ctf.core.event.types.EnumDeclaration;
23 import org.eclipse.linuxtools.ctf.core.event.types.EnumDefinition;
24 import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
25 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
26 import org.junit.After;
27 import org.junit.Before;
28 import org.junit.Test;
29
30 /**
31 * The class <code>EnumDeclarationTest</code> contains tests for the class
32 * <code>{@link EnumDeclaration}</code>.
33 *
34 * @author ematkho
35 * @version $Revision: 1.0 $
36 */
37 public class EnumDeclarationTest {
38
39 private EnumDeclaration fixture;
40
41 /**
42 * Launch the test.
43 *
44 * @param args
45 * the command line arguments
46 */
47 public static void main(String[] args) {
48 new org.junit.runner.JUnitCore().run(EnumDeclarationTest.class);
49 }
50
51 /**
52 * Perform pre-test initialization.
53 */
54 @Before
55 public void setUp() {
56 fixture = new EnumDeclaration(new IntegerDeclaration(1, true, 1,
57 ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8));
58 }
59
60 /**
61 * Perform post-test clean-up.
62 */
63 @After
64 public void tearDown() {
65 // Add additional tear down code here
66 }
67
68 /**
69 * Run the EnumDeclaration(IntegerDeclaration) constructor test.
70 */
71 @Test
72 public void testEnumDeclaration() {
73 IntegerDeclaration containerType = new IntegerDeclaration(1, true, 1,
74 ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
75
76 EnumDeclaration result = new EnumDeclaration(containerType);
77
78 assertNotNull(result);
79 String left = "[declaration] enum[";
80 assertEquals(left, result.toString().substring(0, left.length()));
81 }
82
83 /**
84 * Run the boolean add(long,long,String) method test.
85 */
86 @Test
87 public void testAdd() {
88 long low = 1L;
89 long high = 1L;
90 String label = "";
91
92 boolean result = fixture.add(low, high, label);
93
94 assertTrue(result);
95 }
96
97 /**
98 * Run the EnumDefinition createDefinition(DefinitionScope,String) method
99 * test.
100 */
101 @Test
102 public void testCreateDefinition() {
103 IDefinitionScope definitionScope = null;
104 String fieldName = "";
105
106 EnumDefinition result = fixture.createDefinition(definitionScope,
107 fieldName);
108
109 assertNotNull(result);
110 }
111
112 /**
113 * Run the String query(long) method test.
114 */
115 @Test
116 public void testQuery() {
117 long value = 0;
118 String result = fixture.query(value);
119
120 assertNull(result);
121 }
122
123 /**
124 * Run the String toString() method test.
125 */
126 @Test
127 public void testToString() {
128 String result = fixture.toString();
129
130 String left = "[declaration] enum[";
131 assertEquals(left, result.substring(0, left.length()));
132 }
133 }
This page took 0.042127 seconds and 5 git commands to generate.