Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit eb3d468

Browse files
committed
Fix setup
1 parent c51a3d4 commit eb3d468

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

pom.xml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
34

45
<modelVersion>4.0.0</modelVersion>
56

@@ -67,16 +68,17 @@
6768
<version>1.18.12</version>
6869
<scope>provided</scope>
6970
</dependency>
70-
<dependency>
71-
<groupId>org.junit.jupiter</groupId>
72-
<artifactId>junit-jupiter-api</artifactId>
73-
<version>5.7.0-RC1</version>
74-
<scope>test</scope>
75-
</dependency>
7671
<dependency>
7772
<groupId>org.assertj</groupId>
7873
<artifactId>assertj-core</artifactId>
7974
<version>3.16.1</version>
75+
<scope>test</scope>
76+
</dependency>
77+
<dependency>
78+
<groupId>org.junit.jupiter</groupId>
79+
<artifactId>junit-jupiter-engine</artifactId>
80+
<version>5.7.0-RC1</version>
81+
<scope>test</scope>
8082
</dependency>
8183
</dependencies>
8284

@@ -95,6 +97,12 @@
9597
</plugin>
9698
</plugins>
9799
</pluginManagement>
100+
<plugins>
101+
<plugin>
102+
<artifactId>maven-surefire-plugin</artifactId>
103+
<version>3.0.0-M5</version>
104+
</plugin>
105+
</plugins>
98106
</build>
99107

100108
<distributionManagement>

src/main/java/io/whelk/asciidoc/TemplateMojo.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
package io.whelk.asciidoc;
22

3-
import java.nio.file.Files;
4-
import java.nio.file.Paths;
5-
import java.util.*;
6-
import java.util.concurrent.atomic.AtomicReference;
7-
import java.util.regex.Matcher;
8-
import java.util.regex.Pattern;
9-
import java.util.stream.Collectors;
10-
3+
import lombok.SneakyThrows;
114
import lombok.Value;
125
import org.apache.maven.plugin.AbstractMojo;
136
import org.apache.maven.plugin.MojoExecutionException;
@@ -17,8 +10,16 @@
1710
import org.apache.maven.plugins.annotations.Parameter;
1811
import org.apache.maven.project.MavenProject;
1912

20-
import lombok.SneakyThrows;
21-
import org.assertj.core.util.VisibleForTesting;
13+
import java.nio.file.Files;
14+
import java.nio.file.Paths;
15+
import java.util.ArrayList;
16+
import java.util.Arrays;
17+
import java.util.List;
18+
import java.util.Map;
19+
import java.util.concurrent.atomic.AtomicReference;
20+
import java.util.regex.Matcher;
21+
import java.util.regex.Pattern;
22+
import java.util.stream.Collectors;
2223

2324
@Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE)
2425
public class TemplateMojo extends AbstractMojo {
@@ -42,8 +43,8 @@ public class TemplateMojo extends AbstractMojo {
4243
@Parameter(defaultValue = "${project}", required = true, readonly = true)
4344
MavenProject project;
4445

45-
@VisibleForTesting
46-
Map<String, String> vars;
46+
// @VisibleForTesting
47+
Map<String, String> vars = Map.of();
4748

4849
@SneakyThrows
4950
public void execute() throws MojoExecutionException, MojoFailureException {
@@ -63,7 +64,7 @@ private List<String> readLines(String first, String... more) {
6364
return strings;
6465
}
6566

66-
@VisibleForTesting
67+
// @VisibleForTesting
6768
Map<String, String> loadVars(List<String> strings) {
6869
String varRegex = "^:[\\w\\-]+:"; //includes dashes
6970
Pattern compile = Pattern.compile(varRegex);
@@ -105,7 +106,7 @@ private boolean matchesIncludeLine(final String line) {
105106
line.endsWith("]");
106107
}
107108

108-
@VisibleForTesting
109+
// @VisibleForTesting
109110
List<String> updateIncludeLine(final String line) {
110111
var pathAndOptions = extractPathAndOptions(line);
111112
if (pathAndOptions.optionMap.containsKey(TAG)) {
@@ -145,7 +146,7 @@ class PathAndOptions {
145146
Map<String, String> optionMap;
146147
}
147148

148-
@VisibleForTesting
149+
// @VisibleForTesting
149150
PathAndOptions extractPathAndOptions(String line) {
150151
int pathStart = 9;
151152
Pattern pattern = Pattern.compile("\\[.*\\]$");

src/test/java/io/whelk/asciidoc/TemplateMojoTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package io.whelk.asciidoc;
22

33
import io.whelk.asciidoc.TemplateMojo.PathAndOptions;
4-
54
import org.junit.jupiter.api.Test;
65

7-
import java.util.AbstractMap;
8-
import java.util.HashMap;
96
import java.util.List;
107
import java.util.Map;
118

@@ -29,7 +26,7 @@ void testFilePathExtraction() {
2926
}
3027

3128
@Test
32-
void includeJavaCode() {
29+
void testIncludeJavaCode() {
3330
TemplateMojo templateMojo = new TemplateMojo();
3431
templateMojo.templateDirectory = "./";
3532

0 commit comments

Comments
 (0)