a0fa11f280e2770c653ecfdcffb89d4c8272f57a
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / StringDefinitionTest.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.assertNotNull;
15
16 import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
17 import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
18 import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
19 import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
20 import org.junit.Before;
21 import org.junit.Test;
22
23 /**
24 * The class <code>StringDefinitionTest</code> contains tests for the class
25 * <code>{@link StringDefinition}</code>.
26 *
27 * @author ematkho
28 * @version $Revision: 1.0 $
29 */
30 public class StringDefinitionTest {
31
32 private StringDefinition fixture;
33
34 /**
35 * Perform pre-test initialization.
36 */
37 @Before
38 public void setUp() {
39 String name = "testString";
40 StringDeclaration stringDec = new StringDeclaration();
41 fixture = stringDec.createDefinition(null, name);
42 }
43
44 /**
45 * Run the StringDefinition(StringDeclaration,DefinitionScope,String)
46 * constructor test.
47 */
48 @Test
49 public void testStringDefinition() {
50 StringDeclaration declaration = new StringDeclaration();
51 IDefinitionScope definitionScope = null;
52 String fieldName = "";
53
54 StringDefinition result = new StringDefinition(declaration,
55 definitionScope, fieldName);
56
57 assertNotNull(result);
58 }
59
60 /**
61 * Run the StringDeclaration getDeclaration() method test.
62 */
63 @Test
64 public void testGetDeclaration() {
65 fixture.setString(new StringBuilder());
66 StringDeclaration result = fixture.getDeclaration();
67 assertNotNull(result);
68 }
69
70 /**
71 * Run the StringBuilder getString() method test.
72 */
73 @Test
74 public void testGetString() {
75 fixture.setString(new StringBuilder());
76 StringBuilder result = fixture.getString();
77 assertNotNull(result);
78 }
79
80 /**
81 * Run the String getValue() method test.
82 */
83 @Test
84 public void testGetValue() {
85 fixture.setString(new StringBuilder());
86 String result = fixture.getValue();
87 assertNotNull(result);
88 }
89
90 /**
91 * Run the void read(BitBuffer) method test.
92 */
93 @Test
94 public void testRead() {
95 fixture.setString(new StringBuilder());
96 BitBuffer input = new BitBuffer(java.nio.ByteBuffer.allocateDirect(128));
97 fixture.read(input);
98 }
99
100 /**
101 * Run the void setDeclaration(StringDeclaration) method test.
102 */
103 @Test
104 public void testSetDeclaration() {
105 fixture.setString(new StringBuilder());
106 StringDeclaration declaration = new StringDeclaration();
107 fixture.setDeclaration(declaration);
108 }
109
110 /**
111 * Run the void setString(StringBuilder) method test.
112 */
113 @Test
114 public void testSetString() {
115 fixture.setString(new StringBuilder());
116 StringBuilder string = new StringBuilder();
117 fixture.setString(string);
118 }
119
120 /**
121 * Run the String toString() method test.
122 */
123 @Test
124 public void testToString() {
125 fixture.setString(new StringBuilder());
126 String result = fixture.toString();
127 assertNotNull(result);
128 }
129 }
This page took 0.034792 seconds and 5 git commands to generate.