import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import java.nio.channels.FileChannel;
-
import org.eclipse.linuxtools.ctf.core.event.EventDeclaration;
import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.CTFTraceReader;
-import org.eclipse.linuxtools.ctf.core.trace.Stream;
-import org.eclipse.linuxtools.ctf.core.trace.StreamInput;
-import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
+import org.eclipse.linuxtools.internal.ctf.core.trace.Stream;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* The class <code>EventDeclarationTest</code> contains tests for the class
* <code>{@link EventDeclaration}</code>.
- *
+ *
* @author ematkho
* @version $Revision: 1.0 $
*/
+@SuppressWarnings("javadoc")
public class EventDeclarationTest {
private EventDeclaration fixture;
/**
* Launch the test.
- *
+ *
* @param args
* the command line arguments
*/
/**
* Perform pre-test initialization.
- *
- * @throws CTFReaderException
+ *
+ * @throws CTFReaderException
*/
@Before
public void setUp() throws CTFReaderException {
assertFalse(result);
}
- /**
- * Run the EventDefinition createDefinition(StreamInputReader) method test.
- *
- * @throws CTFReaderException
- */
- @Test
- public void testCreateDefinition() throws CTFReaderException {
- StreamInputReader streamInputReader = new StreamInputReader(
- new StreamInput(new Stream(TestParams.createTrace()),
- (FileChannel) null, TestParams.getEmptyFile()));
-
- EventDefinition result = fixture.createDefinition(streamInputReader);
- assertNotNull(result);
- }
-
/**
* Run the boolean equals(Object) method test.
- *
- * @throws CTFReaderException
+ *
+ * @throws CTFReaderException
*/
@Test
public void testEquals() throws CTFReaderException {
/**
* Test for the EventDefinition class
- *
- * @throws CTFReaderException
+ *
+ * @throws CTFReaderException
*/
@Test
public void testEventDefinition() throws CTFReaderException {
assertNotNull(ed.lookupDefinition("fields")); //$NON-NLS-1$
assertNull(ed.lookupDefinition("other")); //$NON-NLS-1$
assertNotNull(ed.toString());
- ed.context = ed.getFields();
+ ed.setContext( ed.getFields());
assertNotNull(ed.toString());
+ }
+
+ EventDeclaration e1;
+ EventDeclaration e2;
+
+
+ @Test
+ public void testEquals1(){
+ e1 = new EventDeclaration();
+ assertFalse(e1.equals(null));
+ }
+
+ @Test
+ public void testEquals2(){
+ e1 = EventDeclaration.getLostEventDeclaration();
+ assertFalse(e1.equals(new Long(23L)));
+ }
+
+ @Test
+ public void testEquals3(){
+ e1 = EventDeclaration.getLostEventDeclaration();
+ assertEquals(e1,e1);
+ }
+
+ @Test
+ public void testEquals4(){
+ e1 = EventDeclaration.getLostEventDeclaration();
+ e2 = EventDeclaration.getLostEventDeclaration();
+ assertEquals(e1,e2);
+ }
+ @Test
+ public void testEquals5(){
+ e1 = EventDeclaration.getLostEventDeclaration();
+ e2 = new EventDeclaration();
+ assertFalse(e1.equals(e2));
}
}