-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathReporterInspectorIT.java
More file actions
60 lines (44 loc) · 2.64 KB
/
ReporterInspectorIT.java
File metadata and controls
60 lines (44 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package org.utplsql.api;
import org.junit.jupiter.api.Test;
import org.utplsql.api.compatibility.CompatibilityProxy;
import org.utplsql.api.exception.InvalidVersionException;
import org.utplsql.api.reporter.CoreReporters;
import org.utplsql.api.reporter.ReporterFactory;
import org.utplsql.api.reporter.inspect.ReporterInfo;
import org.utplsql.api.reporter.inspect.ReporterInspector;
import java.sql.SQLException;
import java.util.Comparator;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
class ReporterInspectorIT extends AbstractDatabaseTest {
private ReporterFactory getReporterFactory() throws SQLException {
CompatibilityProxy proxy = new CompatibilityProxy(getConnection());
return ReporterFactory.createDefault(proxy);
}
@Test
void testGetReporterInfo() throws SQLException, InvalidVersionException {
CompatibilityProxy proxy = new CompatibilityProxy(getConnection());
ReporterInspector inspector = ReporterInspector.create(getReporterFactory(), getConnection());
Map<String, ReporterInfo> infos = inspector.getReporterInfoMap();
assertEquals(infos.get(CoreReporters.UT_COVERAGE_HTML_REPORTER.name()).getType(), ReporterInfo.Type.SQL_WITH_JAVA);
assertEquals(infos.get(CoreReporters.UT_COVERAGE_SONAR_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
assertEquals(infos.get(CoreReporters.UT_COVERALLS_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
assertEquals(infos.get(CoreReporters.UT_DOCUMENTATION_REPORTER.name()).getType(), ReporterInfo.Type.SQL_WITH_JAVA);
assertEquals(infos.get(CoreReporters.UT_SONAR_TEST_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
assertEquals(infos.get(CoreReporters.UT_TEAMCITY_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
assertEquals(infos.get(CoreReporters.UT_XUNIT_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
if (CoreReporters.UT_COVERAGE_COBERTURA_REPORTER.isAvailableFor(proxy.getDatabaseVersion())) {
assertEquals(infos.get(CoreReporters.UT_COVERAGE_COBERTURA_REPORTER.name()).getType(), ReporterInfo.Type.SQL);
}
}
@Test
void printReporterInfos() throws SQLException, InvalidVersionException {
ReporterInspector inspector = ReporterInspector.create(getReporterFactory(), getConnection());
inspector.getReporterInfos().stream()
.sorted(Comparator.comparing(ReporterInfo::getName))
.forEach(r -> {
System.out.println(r.getName() + " (" + r.getType().name() + "): " + r.getDescription());
System.out.println();
});
}
}