1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
package org.devacfr.testing.jupiter; |
20 |
|
|
21 |
|
import javax.annotation.Nonnull; |
22 |
|
import javax.annotation.Nullable; |
23 |
|
|
24 |
|
import java.nio.file.Path; |
25 |
|
import java.nio.file.Paths; |
26 |
|
import java.util.function.Function; |
27 |
|
|
28 |
|
import com.google.common.io.ByteSource; |
29 |
|
import com.google.common.io.Resources; |
30 |
|
import org.apache.maven.doxia.parser.AbstractParserTest; |
31 |
|
import org.devacfr.testing.util.Approvals; |
32 |
|
import org.junit.jupiter.api.BeforeEach; |
33 |
|
import org.junit.jupiter.api.TestInfo; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 31,6% |
Uncovered Elements: 26 (38) |
Complexity: 18 |
Complexity Density: 0,95 |
|
50 |
|
public abstract class ParserTestCase extends AbstractParserTest { |
51 |
|
|
52 |
|
private TestInfo testInfo; |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
54 |
4 |
@BeforeEach... |
55 |
|
public final void beforeEachMethod(final TestInfo testInfo) { |
56 |
4 |
this.testInfo = testInfo; |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0 |
public String getName() {... |
60 |
0 |
return this.getClass().getSimpleName(); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
@return |
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
68 |
2 |
@Nonnull... |
69 |
|
public final Path getPackagePath() { |
70 |
2 |
return Paths.get(getPackagePath(this.getClass())); |
71 |
|
} |
72 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
73 |
0 |
public ByteSource getResource(final String filename) {... |
74 |
0 |
return Resources.asByteSource(Resources.getResource(getPackagePath().resolve(filename).toString())); |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
@param |
81 |
|
|
82 |
|
@return |
83 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
84 |
2 |
@Nonnull... |
85 |
|
public static final String getPackagePath(@Nonnull final Class<?> testClass) { |
86 |
2 |
return testClass.getPackage().getName().replace('.', '/'); |
87 |
|
} |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
89 |
0 |
public String getActualResource() {... |
90 |
0 |
return Approvals.getActualResource(getPackagePath(), this.getClass(), getMethodName(), null); |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
93 |
0 |
public String getExpectedResource() {... |
94 |
0 |
return Approvals.getExpectedResource(getPackagePath(), this.getClass(), getMethodName(), null, null); |
95 |
|
} |
96 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
97 |
0 |
public String getActualResource(final String extension) {... |
98 |
0 |
return Approvals.getActualResource(getPackagePath(), this.getClass(), getMethodName(), extension); |
99 |
|
} |
100 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
101 |
0 |
public String getExpectedResource(final String extension) {... |
102 |
0 |
return Approvals.getExpectedResource(getPackagePath(), this.getClass(), getMethodName(), extension, null); |
103 |
|
} |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0 |
public String getExpectedResource(final String extension, final Function<String, String> transformer) {... |
106 |
0 |
return Approvals |
107 |
|
.getExpectedResource(getPackagePath(), this.getClass(), getMethodName(), extension, transformer); |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0 |
public void verify() {... |
111 |
0 |
Approvals.verify(getPackagePath(), this.getClass(), getMethodName(), (Function<String, String>) null, null); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
|
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0 |
public void verify(final String extension) {... |
119 |
0 |
Approvals |
120 |
|
.verify(getPackagePath(), this.getClass(), getMethodName(), (Function<String, String>) null, extension); |
121 |
|
} |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0 |
public void verify(final Function<String, String> transform) {... |
124 |
0 |
Approvals.verify(getPackagePath(), this.getClass(), getMethodName(), transform, null); |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
@param |
129 |
|
@param |
130 |
|
|
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
2 |
public void verify(final Function<String, String> transform, @Nullable final String extension) {... |
133 |
2 |
Approvals.verify(getPackagePath(), this.getClass(), getMethodName(), transform, extension); |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
@param |
138 |
|
|
139 |
|
@param |
140 |
|
|
141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
142 |
0 |
public void verify(@Nullable final String actual, @Nullable final String extension) {... |
143 |
0 |
Approvals.verify(getPackagePath(), this.getClass(), getMethodName(), actual, extension); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
@param |
148 |
|
|
149 |
|
@param |
150 |
|
|
151 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
152 |
0 |
public void verify(@Nonnull final Path actualFile, @Nullable final String extension) {... |
153 |
0 |
Approvals.verify(getPackagePath(), this.getClass(), getMethodName(), actualFile, extension); |
154 |
|
} |
155 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0,67 |
|
156 |
2 |
private String getMethodName() {... |
157 |
2 |
if (testInfo == null) { |
158 |
0 |
return null; |
159 |
|
} |
160 |
2 |
return this.testInfo.getTestMethod().get().getName(); |
161 |
|
} |
162 |
|
} |