1   /*
2    * Copyright (c) 2003-2008, by Henrik Arro and Contributors
3    *
4    * This file is part of JSeq, a tool to automatically create
5    * sequence diagrams by tracing program execution.
6    *
7    * See <http://jseq.sourceforge.net> for more information.
8    *
9    * JSeq is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of
12   * the License, or (at your option) any later version.
13   *
14   * JSeq is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   * GNU Lesser General Public License for more details.
18   *
19   * You should have received a copy of the GNU Lesser General Public License
20   * along with JSeq. If not, see <http://www.gnu.org/licenses/>.
21   */
22  
23  package th.co.edge.jseq;
24  
25  import junit.framework.Test;
26  import junit.framework.TestCase;
27  import junit.framework.TestSuite;
28  
29  public class ActivationTest extends TestCase {
30      public ActivationTest(String name) {
31          super(name);
32      }
33  
34      public static Test suite() {
35          TestSuite suite = new TestSuite(ActivationTest.class);
36          return suite;
37      }
38  
39      //
40      // Test methods
41      //
42  
43      public void testConstructor() {
44          Activation parent = new Activation(null, "class1", new TestMethodImpl(
45                  "method1"), -1);
46          assertEquals("class1", parent.getClassName());
47          assertEquals("method1", parent.getMethod().name());
48          assertEquals(null, parent.getParent());
49  
50          Activation child = new Activation(parent, "class2", new TestMethodImpl(
51                  "method2"), -1);
52          assertEquals("class2", child.getClassName());
53          assertEquals("method2", child.getMethod().name());
54          assertEquals(parent, child.getParent());
55  
56          assertEquals(1, parent.getNumCalls());
57          assertEquals(0, child.getNumCalls());
58  
59          assertEquals(child, parent.getNestedActivations().get(0));
60      }
61  }