Merge branch 'master'
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / StringDefinitionTest.java
1 package org.eclipse.linuxtools.ctf.core.tests.types;
2
3 import static org.junit.Assert.assertNotNull;
4
5 import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
6 import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
7 import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
8 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
9 import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
10 import org.junit.After;
11 import org.junit.Before;
12 import org.junit.Test;
13
14 /**
15 * The class <code>StringDefinitionTest</code> contains tests for the class
16 * <code>{@link StringDefinition}</code>.
17 *
18 * @author ematkho
19 * @version $Revision: 1.0 $
20 */
21 public class StringDefinitionTest {
22
23 private StringDefinition fixture;
24
25 /**
26 * Launch the test.
27 *
28 * @param args
29 * the command line arguments
30 */
31 public static void main(String[] args) {
32 new org.junit.runner.JUnitCore().run(StringDefinitionTest.class);
33 }
34
35 /**
36 * Perform pre-test initialization.
37 *
38 * @throws CTFReaderException
39 */
40 @Before
41 public void setUp() throws CTFReaderException {
42 String name = "testString"; //$NON-NLS-1$
43 StringDeclaration stringDec = new StringDeclaration();
44 fixture = stringDec.createDefinition(null, name);
45 }
46
47 /**
48 * Perform post-test clean-up.
49 */
50 @After
51 public void tearDown() {
52 // Add additional tear down code here
53 }
54
55 /**
56 * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
57 * constructor test.
58 */
59 @Test
60 public void testStringDefinition() {
61 StringDeclaration declaration = new StringDeclaration();
62 IDefinitionScope definitionScope = null;
63 String fieldName = ""; //$NON-NLS-1$
64
65 StringDefinition result = new StringDefinition(declaration,
66 definitionScope, fieldName);
67
68 assertNotNull(result);
69 }
70
71 /**
72 * Run the StringDeclaration getDeclaration() method test.
73 */
74 @Test
75 public void testGetDeclaration() {
76 fixture.setString(new StringBuilder());
77 StringDeclaration result = fixture.getDeclaration();
78 assertNotNull(result);
79 }
80
81 /**
82 * Run the StringBuilder getString() method test.
83 */
84 @Test
85 public void testGetString() {
86 fixture.setString(new StringBuilder());
87 StringBuilder result = fixture.getString();
88 assertNotNull(result);
89 }
90
91 /**
92 * Run the String getValue() method test.
93 */
94 @Test
95 public void testGetValue() {
96 fixture.setString(new StringBuilder());
97 String result = fixture.getValue();
98 assertNotNull(result);
99 }
100
101 /**
102 * Run the void read(BitBuffer) method test.
103 */
104 @Test
105 public void testRead() {
106 fixture.setString(new StringBuilder());
107 BitBuffer input = new BitBuffer(java.nio.ByteBuffer.allocateDirect(128));
108 fixture.read(input);
109 }
110
111 /**
112 * Run the void setDeclaration(StringDeclaration) method test.
113 */
114 @Test
115 public void testSetDeclaration() {
116 fixture.setString(new StringBuilder());
117 StringDeclaration declaration = new StringDeclaration();
118 fixture.setDeclaration(declaration);
119 }
120
121 /**
122 * Run the void setString(StringBuilder) method test.
123 */
124 @Test
125 public void testSetString() {
126 fixture.setString(new StringBuilder());
127 StringBuilder string = new StringBuilder();
128 fixture.setString(string);
129 }
130
131 /**
132 * Run the String toString() method test.
133 */
134 @Test
135 public void testToString() {
136 fixture.setString(new StringBuilder());
137 String result = fixture.toString();
138 assertNotNull(result);
139 }
140 }
This page took 0.034021 seconds and 5 git commands to generate.