Commit | Line | Data |
---|---|---|
d18dd09b ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.tmf.tests.event; | |
14 | ||
d18dd09b ASL |
15 | import org.eclipse.linuxtools.tmf.event.TmfEventSource; |
16 | ||
75828b1a FC |
17 | import junit.framework.TestCase; |
18 | ||
d18dd09b ASL |
19 | /** |
20 | * <b><u>TmfEventSourceTest</u></b> | |
21 | * <p> | |
75828b1a | 22 | * TODO: Implement me. Please. |
d18dd09b ASL |
23 | */ |
24 | public class TmfEventSourceTest extends TestCase { | |
25 | ||
75828b1a | 26 | private final Object fSource = new String("Some source"); |
d18dd09b | 27 | |
75828b1a | 28 | // ======================================================================== |
d18dd09b | 29 | // Housekeeping |
75828b1a | 30 | // ======================================================================== |
d18dd09b | 31 | |
d18dd09b ASL |
32 | public TmfEventSourceTest(String name) { |
33 | super(name); | |
34 | } | |
35 | ||
36 | @Override | |
37 | protected void setUp() throws Exception { | |
38 | super.setUp(); | |
39 | } | |
40 | ||
41 | @Override | |
42 | protected void tearDown() throws Exception { | |
43 | super.tearDown(); | |
44 | } | |
45 | ||
75828b1a | 46 | // ======================================================================== |
d18dd09b | 47 | // Constructors |
75828b1a | 48 | // ======================================================================== |
d18dd09b ASL |
49 | |
50 | public void testTmfEventSourceDefault() { | |
51 | TmfEventSource source = new TmfEventSource(); | |
52 | assertEquals("getSourceId", null, source.getSourceId()); | |
53 | } | |
54 | ||
55 | public void testTmfEventSource() { | |
75828b1a FC |
56 | TmfEventSource source = new TmfEventSource(fSource); |
57 | assertSame("getSourceId", fSource, source.getSourceId()); | |
d18dd09b ASL |
58 | } |
59 | ||
60 | public void testTmfEventSourceCopy() { | |
75828b1a | 61 | TmfEventSource original = new TmfEventSource(fSource); |
d18dd09b | 62 | TmfEventSource source = new TmfEventSource(original); |
75828b1a | 63 | assertSame("getSourceId", fSource, source.getSourceId()); |
d18dd09b ASL |
64 | } |
65 | ||
75828b1a FC |
66 | public void testCloneShallowCopy() { |
67 | TmfEventSource original = new TmfEventSource(fSource); | |
68 | TmfEventSource source = original.clone(); | |
69 | assertSame("getSourceId", fSource, source.getSourceId()); | |
d18dd09b ASL |
70 | } |
71 | ||
75828b1a FC |
72 | // public void testCloneDeepCopy() { |
73 | // TmfEventSource original = new TmfEventSource(fSource); | |
74 | // TmfEventSource source = original.clone(); | |
75 | // assertNotSame("getSourceId", fSource, source.getSourceId()); | |
76 | // assertEquals ("getSourceId", fSource, source.getSourceId()); | |
77 | // } | |
d18dd09b | 78 | |
75828b1a FC |
79 | // ======================================================================== |
80 | // Operators | |
81 | // ======================================================================== | |
d18dd09b ASL |
82 | |
83 | public void testToString() { | |
84 | String expected1 = "[TmfEventSource(" + "null" + ")]"; | |
75828b1a FC |
85 | TmfEventSource source1 = new TmfEventSource(); |
86 | assertEquals("toString", expected1, source1.toString()); | |
d18dd09b | 87 | |
75828b1a FC |
88 | String expected2 = "[TmfEventSource(" + fSource.toString() + ")]"; |
89 | TmfEventSource source2 = new TmfEventSource(fSource); | |
90 | assertEquals("toString", expected2, source2.toString()); | |
d18dd09b ASL |
91 | } |
92 | ||
93 | } |