LTTng: CPU usage analysis from the LTTng kernel trace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core.tests / src / org / eclipse / linuxtools / tmf / core / tests / ctfadaptor / CtfTmfTimestampTest.java
CommitLineData
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
15package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
16
17import static org.junit.Assert.assertEquals;
18import static org.junit.Assert.assertNotNull;
19
05e27e67
PT
20import java.text.DateFormat;
21import java.text.SimpleDateFormat;
22import java.util.Date;
23
81c8e6f7 24import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTimestamp;
81c8e6f7
MK
25import 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
MK
33 */
34public class CtfTmfTimestampTest {
81c8e6f7 35
81c8e6f7 36 /**
95bf10e7 37 * Run the CtfTmfTimestamp(long) constructor test.
81c8e6f7
MK
38 */
39 @Test
95bf10e7
AM
40 public void testCtfTmfTimestamp() {
41 long timestamp = 1L;
05e27e67
PT
42 DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS");
43 Date d = new Date(timestamp / 1000000);
81c8e6f7 44
95bf10e7 45 CtfTmfTimestamp result = new CtfTmfTimestamp(timestamp);
81c8e6f7 46
81c8e6f7 47 assertNotNull(result);
cad06250 48 assertEquals(df.format(d) + " 000 001", result.toString());
81c8e6f7
MK
49 assertEquals(0, result.getPrecision());
50 assertEquals(-9, result.getScale());
51 assertEquals(1L, result.getValue());
52 }
1c5a6a8f 53}
This page took 0.05484 seconds and 5 git commands to generate.