9a1e75ab641d9b0f8fc5cb05712c7812f72b5578
1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
3 import static org
.junit
.Assert
.assertEquals
;
4 import static org
.junit
.Assert
.assertFalse
;
5 import static org
.junit
.Assert
.assertNotNull
;
6 import static org
.junit
.Assert
.assertNull
;
7 import static org
.junit
.Assert
.assertTrue
;
10 import java
.io
.IOException
;
11 import java
.nio
.channels
.FileChannel
;
13 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.Definition
;
14 import org
.eclipse
.linuxtools
.ctf
.core
.tests
.TestParams
;
15 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.CTFReaderException
;
16 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.Stream
;
17 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInput
;
18 import org
.junit
.After
;
19 import org
.junit
.Before
;
20 import org
.junit
.Test
;
23 * The class <code>StreamInputTest</code> contains tests for the class
24 * <code>{@link StreamInput}</code>.
27 * @version $Revision: 1.0 $
29 @SuppressWarnings("javadoc")
30 public class StreamInputTest
{
32 private StreamInput fixture
;
38 * the command line arguments
40 public static void main(String
[] args
) {
41 new org
.junit
.runner
.JUnitCore().run(StreamInputTest
.class);
45 * Perform pre-test initialization.
47 * @throws CTFReaderException
50 public void setUp() throws CTFReaderException
{
51 fixture
= new StreamInput(new Stream(TestParams
.createTrace()),
52 (FileChannel
) null, createFile());
53 fixture
.setTimestampEnd(1L);
57 * Perform post-test clean-up.
60 public void tearDown() {
61 // Add additional tear down code here
64 private static File
createFile() {
65 return new File("Tests/traces/trace20m/channel_0"); //$NON-NLS-1$
69 * Run the StreamInput(Stream,FileChannel,File) constructor test.
72 public void testStreamInput() {
73 assertNotNull(fixture
);
77 * Run the FileChannel getFileChannel() method test.
82 public void testGetFileChannel() throws IOException
{
83 FileChannel result
= fixture
.getFileChannel();
91 * Run the String getFilename() method test.
94 public void testGetFilename() {
95 String result
= fixture
.getFilename();
96 assertNotNull(result
);
100 * Run the String getPath() method test.
103 public void testGetPath() {
104 String result
= fixture
.getPath();
105 assertNotNull(result
);
109 * Run the Stream getStream() method test.
112 public void testGetStream() {
113 Stream result
= fixture
.getStream();
114 assertNotNull(result
);
118 * Run the long getTimestampEnd() method test.
121 public void testGetTimestampEnd() {
122 long result
= fixture
.getTimestampEnd();
123 assertTrue(0L < result
);
127 * Run the Definition lookupDefinition(String) method test.
130 public void testLookupDefinition() {
131 Definition result
= fixture
.lookupDefinition("id"); //$NON-NLS-1$
136 * Run the void setTimestampEnd(long) method test.
139 public void testSetTimestampEnd() {
140 fixture
.setTimestampEnd(1L);
141 assertEquals(fixture
.getTimestampEnd(), 1L);
149 public void testEquals1() throws CTFReaderException
{
150 s1
= new StreamInput(new Stream(TestParams
.createTrace()),
151 (FileChannel
) null, createFile());
152 assertFalse(s1
.equals(null));
156 public void testEquals2() throws CTFReaderException
{
157 s1
= new StreamInput(new Stream(TestParams
.createTrace()),
158 (FileChannel
) null, createFile());
159 assertFalse(s1
.equals(new Long(23L)));
163 public void testEquals3() throws CTFReaderException
{
164 s1
= new StreamInput(new Stream(TestParams
.createTrace()),
165 (FileChannel
) null, createFile());
170 public void testEquals4() throws CTFReaderException
{
171 s1
= new StreamInput(new Stream(TestParams
.createTrace()),
172 (FileChannel
) null, createFile());
173 s2
= new StreamInput(new Stream(TestParams
.createTrace()),
174 (FileChannel
) null, createFile());
This page took 0.034323 seconds and 5 git commands to generate.