+/*******************************************************************************
+ * Copyright (c) 2012, 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Khouzam - Initial generation with CodePro tools
+ * Alexandre Montplaisir - Clean up, consolidate redundant tests
+ *******************************************************************************/
+
package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocation;
+import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfLocationInfo;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEvent;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
-import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.tests.shared.CtfTmfTestTrace;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
- * The class <code>CtfIteratorTest</code> contains tests for the class <code>{@link CtfIterator}</code>.
+ * The class <code>CtfIteratorTest</code> contains tests for the class
+ * <code>{@link CtfIterator}</code>.
*
- * @generatedBy CodePro at 03/05/12 2:29 PM
* @author ematkho
- * @version $Revision: 1.0 $
+ * @version 1.0
*/
-@SuppressWarnings("static-method")
public class CtfIteratorTest {
+
+ private static final CtfTmfTestTrace testTrace = CtfTmfTestTrace.KERNEL;
+
+ private CtfTmfTrace trace;
+ private CtfIterator iterator;
+
/**
- * Run the CtfIterator(CtfTmfTrace) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * Perform pre-test initialization.
+ * @throws CTFReaderException error
+ */
+ @Before
+ public void setUp() throws CTFReaderException {
+ assumeTrue(testTrace.exists());
+ trace = testTrace.getTrace();
+ iterator = new CtfIterator(trace);
+ CtfLocation ctfLocation = new CtfLocation(new CtfLocationInfo(1, 0));
+ iterator.setLocation(ctfLocation);
+ iterator.increaseRank();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ */
+ @After
+ public void tearDown() {
+ if (iterator != null) {
+ iterator.dispose();
+ }
+ }
+
+ /**
+ * Run the CtfIterator(CtfTmfTrace) constructor on a non init'ed trace.
+ * @throws CTFReaderException error
*/
@Test
- public void testCtfIterator_1()
- throws Exception {
- CtfTmfTrace trace = createTrace();
+ public void testCtfIterator_noinit() throws CTFReaderException {
CtfIterator result = new CtfIterator(trace);
assertNotNull(result);
}
/**
- * Run the CtfIterator(CtfTmfTrace) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * Run the CtfIterator(CtfTmfTrace) constructor on an init'ed trace.
+ * @throws CTFReaderException error
*/
@Test
- public void testCtfIterator_2()
- throws Exception {
- CtfTmfTrace trace = createTrace();
+ public void testCtfIterator_init() throws CTFReaderException {
trace.init("test");
-
CtfIterator result = new CtfIterator(trace);
assertNotNull(result);
}
/**
- * Run the CtfIterator(CtfTmfTrace,long,long) constructor test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * Run the CtfIterator(CtfTmfTrace,long,long) constructor test, which
+ * specifies an initial position for the iterator.
+ * @throws CTFReaderException error
*/
@Test
- public void testCtfIterator_3()
- throws Exception {
- CtfTmfTrace trace = createTrace();
+ public void testCtfIterator_position() throws CTFReaderException {
long timestampValue = 1L;
long rank = 1L;
-
- CtfIterator result = new CtfIterator(trace, timestampValue, rank);
+ CtfIterator result = new CtfIterator(trace, new CtfLocationInfo(timestampValue, 0), rank);
assertNotNull(result);
}
/**
* Run the boolean advance() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testAdvance_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- boolean result = fixture.advance();
- assertTrue(result);
- }
-
- /**
- * Run the boolean advance() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testAdvance_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- boolean result = fixture.advance();
-
+ public void testAdvance() {
+ boolean result = iterator.advance();
assertTrue(result);
}
/**
* Run the CtfIterator clone() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testClone_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- CtfIterator result = fixture.clone();
+ public void testClone() {
+ CtfIterator result = iterator.clone();
assertNotNull(result);
}
/**
* Run the int compareTo(CtfIterator) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * @throws CTFReaderException error
*/
-
@Test
- public void testCompareTo_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- CtfIterator o = new CtfIterator(createTrace());
-
- int result = fixture.compareTo(o);
+ public void testCompareTo() throws CTFReaderException {
+ CtfIterator o = new CtfIterator(trace);
+ int result = iterator.compareTo(o);
assertEquals(1L, result);
}
/**
- * @return
- * @throws TmfTraceException
- */
- private CtfTmfTrace createTrace() throws TmfTraceException {
- return TestParams.createTrace();
- }
-
- /**
- * Run the int compareTo(CtfIterator) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testCompareTo_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- CtfIterator o = new CtfIterator(createTrace());
-
- int result = fixture.compareTo(o);
-
- assertEquals(1, result);
- }
-
- /**
- * Run the int compareTo(CtfIterator) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testCompareTo_3()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- CtfIterator o = new CtfIterator(createTrace());
-
- int result = fixture.compareTo(o);
- assertEquals(1, result);
- }
-
- /**
- * Run the void dispose() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * Run the boolean equals(Object) method test. Compare with another iterator
+ * on the same trace.
+ * @throws CTFReaderException error
*/
@Test
- public void testDispose_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- fixture.dispose();
- }
-
- /**
- * Run the boolean equals(Object) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testEquals_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- CtfIterator obj = new CtfIterator(createTrace());
- CtfLocation ctfLocation1 = new CtfLocation(new Long(1L));
- ctfLocation1.setLocation(new Long(1L));
+ public void testEquals_other() throws CTFReaderException {
+ CtfIterator obj = new CtfIterator(trace);
+ CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0));
obj.setLocation(ctfLocation1);
obj.increaseRank();
- boolean result = fixture.equals(obj);
-
+ boolean result = iterator.equals(obj);
assertTrue(result);
}
/**
- * Run the boolean equals(Object) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
+ * Run the boolean equals(Object) method test. Compare with an empty object.
*/
@Test
- public void testEquals_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
+ public void testEquals_empty() {
Object obj = new Object();
-
- boolean result = fixture.equals(obj);
-
- assertFalse(result);
- }
-
- /**
- * Run the boolean equals(Object) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testEquals_3()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- Object obj = new Object();
-
- boolean result = fixture.equals(obj);
+ boolean result = iterator.equals(obj);
assertFalse(result);
}
/**
* Run the CtfTmfTrace getCtfTmfTrace() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testGetCtfTmfTrace_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- CtfTmfTrace result = fixture.getCtfTmfTrace();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- assertNotNull(result);
- }
-
- /**
- * Run the CtfTmfEvent getCurrentEvent() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testGetCurrentEvent_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- CtfTmfEvent result = fixture.getCurrentEvent();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testGetCtfTmfTrace() {
+ CtfTmfTrace result = iterator.getCtfTmfTrace();
assertNotNull(result);
}
/**
* Run the CtfTmfEvent getCurrentEvent() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testGetCurrentEvent_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- CtfTmfEvent result = fixture.getCurrentEvent();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testGetCurrentEvent() {
+ CtfTmfEvent result = iterator.getCurrentEvent();
assertNotNull(result);
}
/**
* Run the CtfLocation getLocation() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testGetLocation_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- CtfLocation result = fixture.getLocation();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testGetLocation() {
+ CtfLocation result = iterator.getLocation();
assertNotNull(result);
}
/**
* Run the long getRank() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testGetRank_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- long result = fixture.getRank();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testGetRank() {
+ long result = iterator.getRank();
assertEquals(1L, result);
}
/**
* Run the boolean hasValidRank() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testHasValidRank_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- boolean result = fixture.hasValidRank();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- assertTrue(result);
- }
-
- /**
- * Run the boolean hasValidRank() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testHasValidRank_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- boolean result = fixture.hasValidRank();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testHasValidRank() {
+ boolean result = iterator.hasValidRank();
assertTrue(result);
}
/**
* Run the int hashCode() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testHashCode_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- int result = fixture.hashCode();
- int result2 = fixture.hashCode();
+ public void testHashCode() {
+ int result = iterator.hashCode();
+ int result2 = iterator.hashCode();
assertEquals(result, result2);
}
/**
* Run the void increaseRank() method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testIncreaseRank_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
-
- fixture.increaseRank();
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ public void testIncreaseRank() {
+ iterator.increaseRank();
}
/**
* Run the boolean seek(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testSeek_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
+ public void testSeek() {
long timestamp = 1L;
-
- boolean result = fixture.seek(timestamp);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- assertTrue(result);
- }
-
- /**
- * Run the boolean seek(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testSeek_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- long timestamp = 1L;
-
- boolean result = fixture.seek(timestamp);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- assertTrue(result);
- }
-
- /**
- * Run the boolean seekRank(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testSeekRank_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- long rank = 1L;
-
- boolean result = fixture.seekRank(rank);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- assertTrue(result);
- }
-
- /**
- * Run the boolean seekRank(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testSeekRank_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- long rank = 1L;
-
- boolean result = fixture.seekRank(rank);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
+ boolean result = iterator.seek(timestamp);
assertTrue(result);
}
/**
* Run the void setLocation(ITmfLocation<?>) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
*/
@Test
- public void testSetLocation_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- CtfLocation location = new CtfLocation(new Long(1L));
- location.setLocation(new Long(1L));
-
- fixture.setLocation(location);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- }
-
- /**
- * Run the void setRank(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testSetRank_1()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- long rank = 1L;
-
- fixture.setRank(rank);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- }
-
- /**
- * Run the void setRank(long) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Test
- public void testSetRank_2()
- throws Exception {
- CtfIterator fixture = new CtfIterator(createTrace());
- CtfLocation ctfLocation = new CtfLocation(new Long(1L));
- ctfLocation.setLocation(new Long(1L));
- fixture.setLocation(ctfLocation);
- fixture.increaseRank();
- long rank = 1L;
-
- fixture.setRank(rank);
-
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.NullPointerException
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.createStreamInputReaders(CTFTraceReader.java:152)
- // at org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader.<init>(CTFTraceReader.java:92)
- // at org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfIterator.<init>(CtfIterator.java:40)
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * if the initialization fails for some reason
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @Before
- public void setUp()
- throws Exception {
- // add additional set up code here
- }
-
- /**
- * Perform post-test clean-up.
- *
- * @throws Exception
- * if the clean-up fails for some reason
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- @After
- public void tearDown()
- throws Exception {
- // Add additional tear down code here
- }
-
- /**
- * Launch the test.
- *
- * @param args the command line arguments
- *
- * @generatedBy CodePro at 03/05/12 2:29 PM
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(CtfIteratorTest.class);
+ public void testSetLocation() {
+ CtfLocation location = new CtfLocation(new CtfLocationInfo(1, 0));
+ iterator.setLocation(location);
}
-}
\ No newline at end of file
+}