tmf: Split "CTF adaptor" into separate plugins/feature
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ctf.core.tests / src / org / eclipse / linuxtools / tmf / ctf / core / tests / CtfTmfTimestampTest.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 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 * Matthew Khouzam - Initial generation with CodePro tools
11 * Alexandre Montplaisir - Clean up, consolidate redundant tests
12 * Patrick Tasse - Fix for local time zone
13 *******************************************************************************/
14
15 package org.eclipse.linuxtools.tmf.ctf.core.tests;
16
17 import static org.junit.Assert.assertEquals;
18 import static org.junit.Assert.assertNotNull;
19
20 import java.text.DateFormat;
21 import java.text.SimpleDateFormat;
22 import java.util.Date;
23
24 import org.eclipse.linuxtools.tmf.ctf.core.CtfTmfTimestamp;
25 import org.junit.Test;
26
27 /**
28 * The class <code>CtfTmfTimestampTest</code> contains tests for the class
29 * <code>{@link CtfTmfTimestamp}</code>.
30 *
31 * @author ematkho
32 * @version 1.0
33 */
34 public class CtfTmfTimestampTest {
35
36 /**
37 * Run the CtfTmfTimestamp(long) constructor test.
38 */
39 @Test
40 public void testCtfTmfTimestamp() {
41 long timestamp = 1L;
42 DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
43 Date d = new Date(timestamp / 1000000);
44
45 CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
46
47 assertNotNull(result);
48 assertEquals(df.format(d) + " 000 001", result.toString());
49 assertEquals(0, result.getPrecision());
50 assertEquals(-9, result.getScale());
51 assertEquals(1L, result.getValue());
52 }
53 }
This page took 0.031167 seconds and 5 git commands to generate.