1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Matthew Khouzam - Initial generation with CodePro tools
11 * Alexandre Montplaisir - Clean up, consolidate redundant tests
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
;
16 import static org
.junit
.Assert
.assertEquals
;
17 import static org
.junit
.Assert
.assertNotNull
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.ITmfTimestamp
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.timestamp
.TmfTimestamp
;
21 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.CtfLocation
;
22 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.CtfLocationInfo
;
23 import org
.junit
.Before
;
24 import org
.junit
.Test
;
27 * The class <code>CtfLocationTest</code> contains tests for the class
28 * <code>{@link CtfLocation}</code>.
33 public class CtfLocationTest
{
35 private CtfLocation fixture
;
38 * Perform pre-test initialization.
42 fixture
= new CtfLocation(new CtfLocationInfo(1, 0));
46 * Run the CtfLocation(Long) constructor test.
49 public void testCtfLocation_long() {
50 CtfLocationInfo location
= new CtfLocationInfo(1, 0);
51 CtfLocation result
= new CtfLocation(location
);
53 assertNotNull(result
);
54 assertEquals(1L, result
.getLocationInfo().getTimestamp());
58 * Run the CtfLocation(ITmfTimestamp) constructor test.
61 public void testCtfLocation_timestamp() {
62 ITmfTimestamp timestamp
= new TmfTimestamp();
63 CtfLocation result
= new CtfLocation(timestamp
);
65 assertNotNull(result
);
66 assertEquals(0L, result
.getLocationInfo().getTimestamp());
70 * Run the Long getLocation() method test.
73 public void testGetLocation() {
74 CtfLocationInfo location
= fixture
.getLocationInfo();
75 long result
= location
.getTimestamp();
76 assertEquals(1L, result
);
80 * Run the void setLocation(Long) method test.
83 public void testSetLocation() {
84 CtfLocationInfo location
= new CtfLocationInfo(1337, 7331);
85 fixture
= new CtfLocation(location
);
89 * Test the toString() method with a valid location.
92 public void testToString_valid(){
93 CtfLocation fixture2
= new CtfLocation(new CtfLocationInfo(1337, 7331));
94 assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2
.toString());
98 * Test the toString() method with an invalid location.
101 public void testToString_invalid(){
102 CtfLocation fixture2
= new CtfLocation(new CtfLocationInfo(-1, -1));
103 assertEquals("CtfLocation [INVALID]", fixture2
.toString());
This page took 0.033528 seconds and 5 git commands to generate.