tmf: Rework test trace classes
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui.tests / src / org / eclipse / linuxtools / tmf / ui / tests / trace / CustomXmlTraceBadlyFormedTest.java
CommitLineData
eb8ea213
MK
1package org.eclipse.linuxtools.tmf.ui.tests.trace;
2
3import static org.junit.Assert.fail;
4
5import java.io.File;
6import java.util.ArrayList;
7import java.util.Collection;
8
9import org.eclipse.core.runtime.IStatus;
10import org.junit.Test;
11import org.junit.runner.RunWith;
12import org.junit.runners.Parameterized;
13import org.junit.runners.Parameterized.Parameters;
14
15/**
16 * Malformed xml test, dangerous errors
17 * @author Matthew Khouzam
18 *
19 */
20@RunWith(Parameterized.class)
21public class CustomXmlTraceBadlyFormedTest extends CustomXmlTraceTest {
22
23 private final static String pathname = "tracesets/xml/malformed";
24
25 /**
26 * This should create the parameters to launch the project
27 *
28 * @return the path of the parameters
29 */
30 @Parameters(name = "{index}: path {0}")
31 public static Collection<Object[]> getFiles() {
32 File[] malformedFiles = (new File(pathname)).listFiles();
33 Collection<Object[]> params = new ArrayList<Object[]>();
34 for (File f : malformedFiles) {
35 Object[] arr = new Object[] { f.getAbsolutePath() };
36 params.add(arr);
37 }
38 return params;
39 }
40
41 /**
42 * Test all the invalid xml files
43 */
44 @Test
45 public void testBadlyFormed() {
46 IStatus valid = getTrace().validate(null, getPath());
47 if (IStatus.ERROR != valid.getSeverity()) {
48 fail(valid.toString());
49 }
50 }
51
52 /**
53 * ctor
54 *
55 * @param filePath
56 * the path
57 */
58 public CustomXmlTraceBadlyFormedTest(String filePath) {
59 this.setPath(filePath);
60 }
61
62}
This page took 0.027626 seconds and 5 git commands to generate.