Don't catch the FileNotFound exception in CTF tests
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / TestParams.java
1 package org.eclipse.linuxtools.ctf.core.tests;
2
3 import java.io.File;
4
5 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
6 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
7
8 /**
9 * Here are the definitions common to all the CTF parser tests.
10 *
11 * @author alexmont
12 *
13 */
14 public abstract class TestParams {
15
16 /* Path to test traces */
17 private static final String testTracePath1 = "Tests/traces/trace20m"; //$NON-NLS-1$
18 private static CTFTrace testTrace1 = null;
19 private static CTFTrace testTraceFromFile1 = null;
20
21 private static final File emptyFile = new File(""); //$NON-NLS-1$
22 private static CTFTrace emptyTrace = null;
23
24 public static File getEmptyFile() {
25 return emptyFile;
26 }
27
28 public static CTFTrace getEmptyTrace() {
29 if (emptyTrace == null) {
30 try {
31 emptyTrace = new CTFTrace(""); //$NON-NLS-1$
32 } catch (CTFReaderException e) {
33 /* We know this trace should exist */
34 throw new RuntimeException(e);
35 }
36 }
37 return emptyTrace;
38 }
39
40 public static CTFTrace createTrace() throws CTFReaderException {
41 if (testTrace1 == null) {
42 testTrace1 = new CTFTrace(testTracePath1);
43 }
44 return testTrace1;
45 }
46
47 public static CTFTrace createTraceFromFile() {
48 if (testTraceFromFile1 == null) {
49 try {
50 testTraceFromFile1 = new CTFTrace(new File(testTracePath1));
51 } catch (CTFReaderException e) {
52 /* We know this trace should exist */
53 throw new RuntimeException(e);
54 }
55 }
56 return testTraceFromFile1;
57 }
58 }
This page took 0.031635 seconds and 5 git commands to generate.