1
/*******************************************************************************
2
* Copyright (c) 2006 IBM Corporation.
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
9
* IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
10
*******************************************************************************/
12
package org.eclipse.linuxtools.systemtap.ui.structures;
14
import org.eclipse.linuxtools.systemtap.ui.structures.TreeDefinitionNode;
16
import junit.framework.TestCase;
18
public class TreeDefinitionNodeTest extends TestCase {
19
public TreeDefinitionNodeTest(String name) {
23
protected void setUp() throws Exception {
26
data = new StringBuilder("Object");
33
t = new TreeDefinitionNode(data, s, d, true);
34
child = new TreeDefinitionNode(data2, s2, d2, false);
38
public void testTreeDefinitionNode() {
43
TreeDefinitionNode t = new TreeDefinitionNode(d1, s1, d2, false);
44
assertEquals("Create child count", 0, t.getChildCount());
45
assertEquals("Create child string", s1, t.toString());
46
assertEquals("Create child data", d1, t.getData());
47
assertEquals("Create child definition", d2, t.getDefinition());
48
assertFalse("Create child clickable", t.isClickable());
52
public void testGetDefinition() {
53
assertNotSame("Correct definition", d2, t.getDefinition());
54
assertEquals("Correct definition2", d2, ((TreeDefinitionNode)t.getChildAt(0)).getDefinition());
57
public void testSetDefinition() {
58
String s1 = "/user/share/systemtap";
60
assertEquals("Replaced definition", s1, t.getDefinition());
63
public void testDispose() {
64
assertNotNull(t.getDefinition());
66
assertNull(t.getDefinition());
69
protected void tearDown() throws Exception {
74
TreeDefinitionNode child;