1 package org
.eclipse
.linuxtools
.tmf
.core
.tests
.ctfadaptor
;
3 import static org
.junit
.Assert
.assertEquals
;
4 import static org
.junit
.Assert
.assertNotNull
;
6 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTimestamp
;
7 import org
.eclipse
.linuxtools
.tmf
.core
.ctfadaptor
.CtfTmfTimestamp
.TimestampType
;
8 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfTimestamp
;
9 import org
.eclipse
.linuxtools
.tmf
.core
.event
.TmfTimestamp
;
10 import org
.junit
.After
;
11 import org
.junit
.Before
;
12 import org
.junit
.Test
;
15 * The class <code>CtfTmfTimestampTest</code> contains tests for the class <code>{@link CtfTmfTimestamp}</code>.
17 * @generatedBy CodePro at 03/05/12 2:29 PM
19 * @version $Revision: 1.0 $
21 public class CtfTmfTimestampTest
{
23 * Run the CtfTmfTimestamp(long) constructor test.
27 * @generatedBy CodePro at 03/05/12 2:29 PM
30 public void testCtfTmfTimestamp()
34 CtfTmfTimestamp result
= new CtfTmfTimestamp(timestamp
);
35 result
.setType(TimestampType
.NANOS
);
37 // add additional test code here
38 assertNotNull(result
);
39 assertEquals("1 ns", result
.toString()); //$NON-NLS-1$
40 assertEquals(0, result
.getPrecision());
41 assertEquals(-9, result
.getScale());
42 assertEquals(1L, result
.getValue());
47 * Run the boolean equals(Object) method test.
51 * @generatedBy CodePro at 03/05/12 2:29 PM
54 public void testEquals_1()
56 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
57 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
58 CtfTmfTimestamp obj
= new CtfTmfTimestamp(1L);
59 obj
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
61 boolean result
= fixture
.equals(obj
);
63 // add additional test code here
64 assertEquals(true, result
);
68 * Run the boolean equals(Object) method test.
72 * @generatedBy CodePro at 03/05/12 2:29 PM
75 public void testEquals_2()
77 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
78 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
79 Object obj
= new Object();
81 boolean result
= fixture
.equals(obj
);
83 // add additional test code here
84 assertEquals(false, result
);
88 * Run the boolean equals(Object) method test.
92 * @generatedBy CodePro at 03/05/12 2:29 PM
95 public void testEquals_3()
97 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
98 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
99 Object obj
= new Object();
101 boolean result
= fixture
.equals(obj
);
103 // add additional test code here
104 assertEquals(false, result
);
108 * Run the boolean equals(Object) method test.
112 * @generatedBy CodePro at 03/05/12 2:29 PM
115 public void testEquals_4()
117 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
118 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
119 CtfTmfTimestamp obj
= new CtfTmfTimestamp(1L);
120 obj
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
122 boolean result
= fixture
.equals(obj
);
124 // add additional test code here
125 assertEquals(true, result
);
129 * Run the boolean equals(Object) method test.
133 * @generatedBy CodePro at 03/05/12 2:29 PM
136 public void testEquals_5()
138 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
139 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
140 CtfTmfTimestamp obj
= new CtfTmfTimestamp(1L);
141 obj
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
143 boolean result
= fixture
.equals(obj
);
145 // add additional test code here
146 assertEquals(true, result
);
150 * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test.
154 * @generatedBy CodePro at 03/05/12 2:29 PM
157 public void testGetDelta_1()
159 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
160 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
161 ITmfTimestamp ts
= new TmfTimestamp();
163 ITmfTimestamp result
= fixture
.getDelta(ts
);
165 // add additional test code here
166 assertNotNull(result
);
167 assertEquals(0, result
.getPrecision());
168 assertEquals(-9, result
.getScale());
169 assertEquals(1L, result
.getValue());
173 * Run the ITmfTimestamp getDelta(ITmfTimestamp) method test.
177 * @generatedBy CodePro at 03/05/12 2:29 PM
180 public void testGetDelta_2()
182 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
183 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
184 ITmfTimestamp ts
= new TmfTimestamp();
186 ITmfTimestamp result
= fixture
.getDelta(ts
);
188 // add additional test code here
189 assertNotNull(result
);
190 assertEquals(0, result
.getPrecision());
191 assertEquals(-9, result
.getScale());
192 assertEquals(1L, result
.getValue());
196 * Run the CtfTmfTimestamp.TimestampType getType() method test.
200 * @generatedBy CodePro at 03/05/12 2:29 PM
203 public void testGetType_1()
205 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
206 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
208 CtfTmfTimestamp
.TimestampType result
= fixture
.getType();
210 // add additional test code here
211 assertNotNull(result
);
212 assertEquals("DAY", result
.name()); //$NON-NLS-1$
213 assertEquals("DAY", result
.toString()); //$NON-NLS-1$
214 assertEquals(1, result
.ordinal());
218 * Run the int hashCode() method test.
222 * @generatedBy CodePro at 03/05/12 2:29 PM
225 public void testHashCode_1()
227 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
228 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
230 int result
= fixture
.hashCode();
232 // add additional test code here
233 assertEquals(1012115, result
);
237 * Run the int hashCode() method test.
241 * @generatedBy CodePro at 03/05/12 2:29 PM
244 public void testHashCode_2()
246 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
247 fixture
.setType(null);
249 int result
= fixture
.hashCode();
251 // add additional test code here
252 assertEquals(944663, result
);
256 * Run the void setType(TimestampType) method test.
260 * @generatedBy CodePro at 03/05/12 2:29 PM
263 public void testSetType_1()
265 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
266 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
267 CtfTmfTimestamp
.TimestampType value
= CtfTmfTimestamp
.TimestampType
.DAY
;
269 fixture
.setType(value
);
271 // add additional test code here
275 * Run the String toString() method test.
279 * @generatedBy CodePro at 03/05/12 2:29 PM
282 public void testToString_1()
284 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
285 fixture
.setType(CtfTmfTimestamp
.TimestampType
.NANOS
);
287 String result
= fixture
.toString();
289 // add additional test code here
290 assertEquals("1 ns", result
); //$NON-NLS-1$
294 * Run the String toString() method test.
298 * @generatedBy CodePro at 03/05/12 2:29 PM
301 public void testToString_2()
303 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
304 fixture
.setType(CtfTmfTimestamp
.TimestampType
.SECONDS
);
306 String result
= fixture
.toString();
308 // add additional test code here
309 assertEquals("1.0E-9 s", result
); //$NON-NLS-1$
313 * Run the String toString() method test.
317 * @generatedBy CodePro at 03/05/12 2:29 PM
320 public void testToString_3()
322 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
323 fixture
.setType(CtfTmfTimestamp
.TimestampType
.DAY
);
325 String result
= fixture
.toString();
327 // add additional test code here
328 assertEquals("19:00:00.000000001", result
); //$NON-NLS-1$
332 * Run the String toString() method test.
336 * @generatedBy CodePro at 03/05/12 2:29 PM
339 public void testToString_4()
341 CtfTmfTimestamp fixture
= new CtfTmfTimestamp(1L);
342 fixture
.setType(CtfTmfTimestamp
.TimestampType
.FULL_DATE
);
344 String result
= fixture
.toString();
346 // add additional test code here
347 assertEquals("1969-12-31 19:00:00.000000001", result
); //$NON-NLS-1$
351 * Perform pre-test initialization.
354 * if the initialization fails for some reason
356 * @generatedBy CodePro at 03/05/12 2:29 PM
361 // add additional set up code here
365 * Perform post-test clean-up.
368 * if the clean-up fails for some reason
370 * @generatedBy CodePro at 03/05/12 2:29 PM
373 public void tearDown()
375 // Add additional tear down code here
381 * @param args the command line arguments
383 * @generatedBy CodePro at 03/05/12 2:29 PM
385 public static void main(String
[] args
) {
386 new org
.junit
.runner
.JUnitCore().run(CtfTmfTimestampTest
.class);
This page took 0.046571 seconds and 6 git commands to generate.