import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.Map;
import java.util.UUID;
+import org.eclipse.linuxtools.ctf.core.event.CTFClock;
import org.eclipse.linuxtools.ctf.core.event.metadata.exceptions.ParseException;
import org.eclipse.linuxtools.ctf.core.event.types.Definition;
import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
/**
* The class <code>CTFTraceTest</code> contains tests for the class
* <code>{@link CTFTrace}</code>.
- *
+ *
* @author ematkho
* @version $Revision: 1.0 $
*/
/**
* Launch the test.
- *
+ *
* @param args
* the command line arguments
*/
/**
* Run the CTFTrace(File) constructor test with an invalid path.
- *
+ *
* @throws CTFReaderException
*/
@Test(expected = org.eclipse.linuxtools.ctf.core.trace.CTFReaderException.class)
/**
* Run the void addStream(Stream) method test.
- *
+ *
* @throws ParseException
* @throws CTFReaderException
*/
UUID uuid = UUID.randomUUID();
fixture.setUUID(uuid);
}
+
+ /**
+ * Run the CTFClock getClock() method test.
+ */
+ @Test
+ public void testGetClock_1() {
+ CTFClock result = fixture.getClock();
+ assertNull(result);
+ }
+
+ /**
+ * Run the CTFClock getClock() method test.
+ *
+ */
+ @Test
+ public void testGetClock_2() {
+ CTFClock result = fixture.getClock("Blabla"); //$NON-NLS-1$
+ assertNull(result);
+ }
+
+ /**
+ * Run the CTFClock getClock(String) method test.
+ */
+ @Test
+ public void testGetClock_3() {
+ String name = ""; //$NON-NLS-1$
+ CTFClock result = fixture.getClock(name);
+ assertNull(result);
+ }
+
+
+ /**
+ * Run the CTFClock getClock(String) method test.
+ */
+ @Test
+ public void testSetClock_1() {
+ String name = ""; //$NON-NLS-1$
+ fixture.addClock(name, new CTFClock());
+ CTFClock result = fixture.getClock(name);
+
+ assertNotNull(result);
+ }
+
+ /**
+ * Run the CTFClock getClock(String) method test.
+ */
+ @Test
+ public void testSetClock_2() {
+ String name = ""; //$NON-NLS-1$
+ CTFClock ctfClock = new CTFClock();
+ ctfClock.addAttribute("name", "Bob");
+ ctfClock.addAttribute("pi", new Double(java.lang.Math.PI));
+ fixture.addClock(name, ctfClock);
+ CTFClock result = fixture.getClock(name);
+
+ assertNotNull(result);
+ assertTrue( (Double)ctfClock.getProperty("pi")> 3.0);
+ assertTrue( ctfClock.getName().equals("Bob"));
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_1() {
+ String key = "";
+ String result = fixture.lookupEnvironment(key);
+ assertNull(result);
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_2() {
+ String key = "test";
+ String result = fixture.lookupEnvironment(key);
+ assertNull(result);
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_3() {
+ String key = "test";
+ fixture.addEnvironmentVar(key, key);
+ String result = fixture.lookupEnvironment(key);
+ assertTrue(result.equals(key));
+ }
+
+ /**
+ * Run the String lookupEnvironment(String) method test.
+ */
+ @Test
+ public void testLookupEnvironment_4() {
+ String key = "test";
+ fixture.addEnvironmentVar(key, "bozo");
+ fixture.addEnvironmentVar(key, "the clown");
+ String result = fixture.lookupEnvironment(key);
+ assertNotNull(result);
+ }
+
}
/**
* The class <code>StreamTest</code> contains tests for the class
* <code>{@link Stream}</code>.
- *
+ *
* @author ematkho
* @version $Revision: 1.0 $
*/
/**
* Launch the test.
- *
+ *
* @param args
* the command line arguments
*/
/**
* Run the void addEvent(EventDeclaration) method test with the basic
* event.
- * @throws ParseException
+ * @throws ParseException
*/
@Test
public void testAddEvent_base() throws ParseException {
}
/**
- * Run the void addEvent(EventDeclaration) method test with an event
+ * Run the void addEvent(EventDeclaration) method test with an event
* of which we modified the id.
- * @throws ParseException
- *
+ * @throws ParseException
+ *
* @throws ParseException
*/
@Test
EventDeclaration event = new EventDeclaration();
event.setId(1L);
fixture.addEvent(event);
+ assertNotNull(fixture);
}
/**
public void testEventContextIsSet() {
assertTrue(fixture.eventContextIsSet());
}
+ /**
+ * Run the boolean eventContextIsSet() method test.
+ */
+ @Test
+ public void testToString() {
+ assertNotNull(fixture.toString());
+ }
/**
* Run the boolean eventHeaderIsSet() method test.