~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to systemtap/org.eclipse.linuxtools.systemtap.ui.structures.tests/src/org/eclipse/linuxtools/systemtap/ui/structures/TreeDefinitionNodeTest.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 *
 
8
 * Contributors:
 
9
 *     IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
 
10
 *******************************************************************************/
 
11
 
 
12
package org.eclipse.linuxtools.systemtap.ui.structures;
 
13
 
 
14
import org.eclipse.linuxtools.systemtap.ui.structures.TreeDefinitionNode;
 
15
 
 
16
import junit.framework.TestCase;
 
17
 
 
18
public class TreeDefinitionNodeTest extends TestCase {
 
19
        public TreeDefinitionNodeTest(String name) {
 
20
                super(name);
 
21
        }
 
22
 
 
23
        protected void setUp() throws Exception {
 
24
                super.setUp();
 
25
                
 
26
                data = new StringBuilder("Object");
 
27
                data2 = "Data";
 
28
                d = "/usr/share";
 
29
                d2 = "/usr";
 
30
                s = "String";
 
31
                s2 = "bah";
 
32
 
 
33
                t = new TreeDefinitionNode(data, s, d, true);
 
34
                child = new TreeDefinitionNode(data2, s2, d2, false);
 
35
                t.add(child);
 
36
        }
 
37
 
 
38
        public void testTreeDefinitionNode() {
 
39
                String d1 = "One";
 
40
                String d2 = "two";
 
41
                String s1 = "one";
 
42
 
 
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());
 
49
        }
 
50
 
 
51
        
 
52
        public void testGetDefinition() {
 
53
                assertNotSame("Correct definition", d2, t.getDefinition());
 
54
                assertEquals("Correct definition2", d2, ((TreeDefinitionNode)t.getChildAt(0)).getDefinition());
 
55
        }
 
56
        
 
57
        public void testSetDefinition() {
 
58
                String s1 = "/user/share/systemtap";
 
59
                t.setDefinition(s1);
 
60
                assertEquals("Replaced definition", s1, t.getDefinition());
 
61
        }
 
62
        
 
63
        public void testDispose() {
 
64
                assertNotNull(t.getDefinition());
 
65
                t.dispose();
 
66
                assertNull(t.getDefinition());
 
67
        }
 
68
        
 
69
        protected void tearDown() throws Exception {
 
70
                super.tearDown();
 
71
        }
 
72
        
 
73
        TreeDefinitionNode t;
 
74
        TreeDefinitionNode child;
 
75
        Object data;
 
76
        String data2;
 
77
        String s, s2;
 
78
        String d, d2;
 
79
}