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
.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
;
15 * The class <code>StringDefinitionTest</code> contains tests for the class
16 * <code>{@link StringDefinition}</code>.
19 * @version $Revision: 1.0 $
21 public class StringDefinitionTest
{
23 private StringDefinition fixture
;
29 * the command line arguments
31 public static void main(String
[] args
) {
32 new org
.junit
.runner
.JUnitCore().run(StringDefinitionTest
.class);
36 * Perform pre-test initialization.
38 * @throws CTFReaderException
41 public void setUp() throws CTFReaderException
{
42 String name
= "testString"; //$NON-NLS-1$
43 StringDeclaration stringDec
= new StringDeclaration();
44 fixture
= stringDec
.createDefinition(null, name
);
48 * Perform post-test clean-up.
51 public void tearDown() {
52 // Add additional tear down code here
56 * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
60 public void testStringDefinition() {
61 StringDeclaration declaration
= new StringDeclaration();
62 IDefinitionScope definitionScope
= null;
63 String fieldName
= ""; //$NON-NLS-1$
65 StringDefinition result
= new StringDefinition(declaration
,
66 definitionScope
, fieldName
);
68 assertNotNull(result
);
72 * Run the StringDeclaration getDeclaration() method test.
75 public void testGetDeclaration() {
76 fixture
.setString(new StringBuilder());
77 StringDeclaration result
= fixture
.getDeclaration();
78 assertNotNull(result
);
82 * Run the StringBuilder getString() method test.
85 public void testGetString() {
86 fixture
.setString(new StringBuilder());
87 StringBuilder result
= fixture
.getString();
88 assertNotNull(result
);
92 * Run the String getValue() method test.
95 public void testGetValue() {
96 fixture
.setString(new StringBuilder());
97 String result
= fixture
.getValue();
98 assertNotNull(result
);
102 * Run the void read(BitBuffer) method test.
105 public void testRead() {
106 fixture
.setString(new StringBuilder());
107 BitBuffer input
= new BitBuffer(java
.nio
.ByteBuffer
.allocateDirect(128));
112 * Run the void setDeclaration(StringDeclaration) method test.
115 public void testSetDeclaration() {
116 fixture
.setString(new StringBuilder());
117 StringDeclaration declaration
= new StringDeclaration();
118 fixture
.setDeclaration(declaration
);
122 * Run the void setString(StringBuilder) method test.
125 public void testSetString() {
126 fixture
.setString(new StringBuilder());
127 StringBuilder string
= new StringBuilder();
128 fixture
.setString(string
);
132 * Run the String toString() method test.
135 public void testToString() {
136 fixture
.setString(new StringBuilder());
137 String result
= fixture
.toString();
138 assertNotNull(result
);