Package: TestResourcesResultTestCase4

TestResourcesResultTestCase4

nameinstructionbranchcomplexitylinemethod
TestResourcesResultTestCase4()
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
TestResourcesResultTestCase4(File)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
TestResourcesResultTestCase4(File, String, File)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
createResultFile(String)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
getResultDirectoryPath()
M: 85 C: 0
0%
M: 10 C: 0
0%
M: 6 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getResultFile(String)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * Test Framework for Overture
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.test.framework;
23:
24: import java.io.File;
25:
26: public abstract class TestResourcesResultTestCase4<R> extends
27:                 ResultTestCase4<R>
28: {
29:         protected final File testSuiteRoot;
30:         protected final String suiteName;
31:
32:         public TestResourcesResultTestCase4()
33:         {
34:                 super();
35:                 testSuiteRoot = null;
36:                 suiteName = null;
37:         }
38:
39:         public TestResourcesResultTestCase4(File file)
40:         {
41:                 super(file);
42:                 testSuiteRoot = null;
43:                 suiteName = null;
44:         }
45:
46:         // public TestResourcesResultTestCase4(File rootSource,String name, String content)
47:         // {
48:         // super(rootSource,name, content);
49:         // testSuiteRoot = null;
50:         // suiteName = null;
51:         // }
52:
53:         public TestResourcesResultTestCase4(File file, String suiteName,
54:                         File testSuiteRoot)
55:         {
56:                 super(file);
57:                 this.testSuiteRoot = testSuiteRoot;
58:                 this.suiteName = suiteName;
59:         }
60:
61:         @Override
62:         protected File createResultFile(String filename)
63:         {
64:                 new File(getResultDirectoryPath()).mkdirs();
65:                 return getResultFile(filename);
66:         }
67:
68:         @Override
69:         protected File getResultFile(String filename)
70:         {
71:                 return new File(new File(getResultDirectoryPath()), filename);
72:         }
73:
74:         private String getResultDirectoryPath()
75:         {
76:                 // first try choice 1
77:•                if (testSuiteRoot != null)
78:                 {
79:                         String base = file.getParentFile().getAbsolutePath();
80:                         String suiteBase = testSuiteRoot.getAbsolutePath();
81:•                        if (base.startsWith(suiteBase)
82:•                                        && base.length() != suiteBase.length())
83:                         {
84:                                 String tmp = ("src/test/resources/" + suiteName + "/" + base.substring(suiteBase.length() + 1)).replace('\\', '/').replace('/', File.separatorChar).replaceAll(" ", "");
85:                                 return tmp;
86:                         }
87:                 }
88:
89:                 String tmp = file.getParentFile().getPath();
90:                 tmp = tmp.replace('\\', '/');
91:•                if (tmp.startsWith("/") || tmp.contains(":"))
92:                 {
93:                         tmp = tmp.substring(tmp.indexOf('/') + 1);
94:                 }
95:                 return tmp.replace('/', File.separatorChar).replaceAll(" ", "");
96:         }
97:
98: }