/*******************************************************************************
- * Copyright (c) 2012 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import static org.junit.Assert.assertNotNull;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
-import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationData;
-import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
-import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
+import org.eclipse.linuxtools.tmf.core.timestamp.ITmfTimestamp;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimestamp;
import org.junit.Before;
import org.junit.Test;
*/
@Before
public void setUp() {
- fixture = new CtfLocation(new CtfLocationData(1, 0));
+ fixture = new CtfLocation(new CtfLocationInfo(1, 0));
}
/**
*/
@Test
public void testCtfLocation_long() {
- CtfLocationData location = new CtfLocationData(1, 0);
+ CtfLocationInfo location = new CtfLocationInfo(1, 0);
CtfLocation result = new CtfLocation(location);
assertNotNull(result);
- assertEquals(Long.valueOf(1), (Long)result.getLocationInfo().getTimestamp());
+ assertEquals(1L, result.getLocationInfo().getTimestamp());
}
/**
CtfLocation result = new CtfLocation(timestamp);
assertNotNull(result);
- assertEquals(new Long(0L), (Long)result.getLocationInfo().getTimestamp());
- }
-
- /**
- * Run the CtfLocation clone() method test.
- */
- @Test
- public void testClone() {
- CtfLocation result = fixture.clone();
-
- assertNotNull(result);
- assertEquals(Long.valueOf(1), (Long)result.getLocationInfo().getTimestamp());
+ assertEquals(0L, result.getLocationInfo().getTimestamp());
}
/**
*/
@Test
public void testGetLocation() {
- CtfLocationData location = fixture.getLocationInfo();
- Long result = location.getTimestamp();
- assertNotNull(result);
- assertEquals("1", result.toString()); //$NON-NLS-1$
- assertEquals((byte) 1, result.byteValue());
- assertEquals((short) 1, result.shortValue());
- assertEquals(1, result.intValue());
- assertEquals(1L, result.longValue());
- assertEquals(1.0f, result.floatValue(), 1.0f);
- assertEquals(1.0, result.doubleValue(), 1.0);
+ CtfLocationInfo location = fixture.getLocationInfo();
+ long result = location.getTimestamp();
+ assertEquals(1L, result);
}
/**
*/
@Test
public void testSetLocation() {
- CtfLocationData location = new CtfLocationData(1337, 7331);
+ CtfLocationInfo location = new CtfLocationInfo(1337, 7331);
fixture = new CtfLocation(location);
}
*/
@Test
public void testToString_valid(){
- CtfLocation fixture2 = new CtfLocation(new CtfLocationData(1337, 7331));
- assertEquals("CtfLocation: Element [1337/7331]",fixture2.toString()); //$NON-NLS-1$
+ CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(1337, 7331));
+ assertEquals("CtfLocation [fLocationInfo=Element [1337/7331]]", fixture2.toString());
}
/**
*/
@Test
public void testToString_invalid(){
- CtfLocation fixture2 = new CtfLocation(new CtfLocationData(-1, -1));
- assertEquals("CtfLocation: INVALID",fixture2.toString()); //$NON-NLS-1$
+ CtfLocation fixture2 = new CtfLocation(new CtfLocationInfo(-1, -1));
+ assertEquals("CtfLocation [INVALID]", fixture2.toString());
}
}