Commit | Line | Data |
---|---|---|
95bf10e7 | 1 | /******************************************************************************* |
05e27e67 | 2 | * Copyright (c) 2012, 2013 Ericsson |
95bf10e7 AM |
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 | * Matthew Khouzam - Initial generation with CodePro tools | |
11 | * Alexandre Montplaisir - Clean up, consolidate redundant tests | |
05e27e67 | 12 | * Patrick Tasse - Fix for local time zone |
95bf10e7 AM |
13 | *******************************************************************************/ |
14 | ||
81c8e6f7 MK |
15 | package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor; |
16 | ||
17 | import static org.junit.Assert.assertEquals; | |
18 | import static org.junit.Assert.assertNotNull; | |
19 | ||
05e27e67 PT |
20 | import java.text.DateFormat; |
21 | import java.text.SimpleDateFormat; | |
22 | import java.util.Date; | |
23 | ||
81c8e6f7 | 24 | import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp; |
81c8e6f7 MK |
25 | import org.junit.Test; |
26 | ||
27 | /** | |
95bf10e7 AM |
28 | * The class <code>CtfTmfTimestampTest</code> contains tests for the class |
29 | * <code>{@link CtfTmfTimestamp}</code>. | |
81c8e6f7 | 30 | * |
81c8e6f7 | 31 | * @author ematkho |
95bf10e7 | 32 | * @version 1.0 |
81c8e6f7 | 33 | */ |
05e27e67 | 34 | @SuppressWarnings({"nls"}) |
81c8e6f7 | 35 | public class CtfTmfTimestampTest { |
81c8e6f7 | 36 | |
81c8e6f7 | 37 | /** |
95bf10e7 | 38 | * Run the CtfTmfTimestamp(long) constructor test. |
81c8e6f7 MK |
39 | */ |
40 | @Test | |
95bf10e7 AM |
41 | public void testCtfTmfTimestamp() { |
42 | long timestamp = 1L; | |
05e27e67 PT |
43 | DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); |
44 | Date d = new Date(timestamp / 1000000); | |
81c8e6f7 | 45 | |
95bf10e7 | 46 | CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp); |
81c8e6f7 | 47 | |
81c8e6f7 | 48 | assertNotNull(result); |
05e27e67 | 49 | assertEquals(df.format(d) + " 000 001", result.toString()); //$NON-NLS-1$ |
81c8e6f7 MK |
50 | assertEquals(0, result.getPrecision()); |
51 | assertEquals(-9, result.getScale()); | |
52 | assertEquals(1L, result.getValue()); | |
53 | } | |
1c5a6a8f | 54 | } |