1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.types
;
3 import static org
.junit
.Assert
.assertNotNull
;
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
.internal
.ctf
.core
.event
.io
.BitBuffer
;
9 import org
.junit
.After
;
10 import org
.junit
.Before
;
11 import org
.junit
.Test
;
14 * The class <code>StringDefinitionTest</code> contains tests for the class
15 * <code>{@link StringDefinition}</code>.
18 * @version $Revision: 1.0 $
20 public class StringDefinitionTest
{
22 private StringDefinition fixture
;
28 * the command line arguments
30 public static void main(String
[] args
) {
31 new org
.junit
.runner
.JUnitCore().run(StringDefinitionTest
.class);
35 * Perform pre-test initialization.
39 String name
= "testString"; //$NON-NLS-1$
40 StringDeclaration stringDec
= new StringDeclaration();
41 fixture
= stringDec
.createDefinition(null, name
);
45 * Perform post-test clean-up.
48 public void tearDown() {
49 // Add additional tear down code here
53 * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
57 public void testStringDefinition() {
58 StringDeclaration declaration
= new StringDeclaration();
59 IDefinitionScope definitionScope
= null;
60 String fieldName
= ""; //$NON-NLS-1$
62 StringDefinition result
= new StringDefinition(declaration
,
63 definitionScope
, fieldName
);
65 assertNotNull(result
);
69 * Run the StringDeclaration getDeclaration() method test.
72 public void testGetDeclaration() {
73 fixture
.setString(new StringBuilder());
74 StringDeclaration result
= fixture
.getDeclaration();
75 assertNotNull(result
);
79 * Run the StringBuilder getString() method test.
82 public void testGetString() {
83 fixture
.setString(new StringBuilder());
84 StringBuilder result
= fixture
.getString();
85 assertNotNull(result
);
89 * Run the String getValue() method test.
92 public void testGetValue() {
93 fixture
.setString(new StringBuilder());
94 String result
= fixture
.getValue();
95 assertNotNull(result
);
99 * Run the void read(BitBuffer) method test.
102 public void testRead() {
103 fixture
.setString(new StringBuilder());
104 BitBuffer input
= new BitBuffer(java
.nio
.ByteBuffer
.allocateDirect(128));
109 * Run the void setDeclaration(StringDeclaration) method test.
112 public void testSetDeclaration() {
113 fixture
.setString(new StringBuilder());
114 StringDeclaration declaration
= new StringDeclaration();
115 fixture
.setDeclaration(declaration
);
119 * Run the void setString(StringBuilder) method test.
122 public void testSetString() {
123 fixture
.setString(new StringBuilder());
124 StringBuilder string
= new StringBuilder();
125 fixture
.setString(string
);
129 * Run the String toString() method test.
132 public void testToString() {
133 fixture
.setString(new StringBuilder());
134 String result
= fixture
.toString();
135 assertNotNull(result
);