Skip to content

Commit 60f27cb

Browse files
murdosgastaldi
authored andcommitted
more tests for investigation
1 parent c78406a commit 60f27cb

File tree

4 files changed

+250
-0
lines changed

4 files changed

+250
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?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">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<artifactId>jhlite-test-maven-project</artifactId>
6+
<version>0.0.1</version>
7+
<name>Test project</name>
8+
<packaging>pom</packaging>
9+
10+
<properties>
11+
<json-web-token.version>0.11.5</json-web-token.version>
12+
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
13+
<spring-boot.version>2.7.1</spring-boot.version>
14+
</properties>
15+
16+
<dependencyManagement>
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.springdoc</groupId>
20+
<artifactId>springdoc-openapi-ui</artifactId>
21+
<version>${springdoc-openapi.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-dependencies</artifactId>
26+
<version>${spring-boot.version}</version>
27+
<scope>import</scope>
28+
<type>pom</type>
29+
</dependency>
30+
</dependencies>
31+
</dependencyManagement>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>net.logstash.logback</groupId>
36+
<artifactId>logstash-logback-encoder</artifactId>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.springframework.boot</groupId>
41+
<artifactId>spring-boot-starter-parent</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>io.jsonwebtoken</groupId>
45+
<artifactId>jjwt-api</artifactId>
46+
<version>${json-web-token.version}</version>
47+
<classifier>classif</classifier>
48+
<scope>test</scope>
49+
<optional>true</optional>
50+
</dependency>
51+
</dependencies>
52+
53+
<build>
54+
<plugins>
55+
<plugin>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-maven-plugin</artifactId>
58+
</plugin>
59+
</plugins>
60+
<pluginManagement>
61+
<plugins>
62+
<plugin>
63+
<groupId>org.springframework.boot</groupId>
64+
<artifactId>spring-boot-maven-plugin</artifactId>
65+
<version>${spring-boot.version}</version>
66+
<executions>
67+
<execution>
68+
<goals>
69+
<goal>repackage</goal>
70+
</goals>
71+
</execution>
72+
</executions>
73+
<configuration>
74+
<mainClass>${start-class}</mainClass>
75+
</configuration>
76+
</plugin>
77+
</plugins>
78+
</pluginManagement>
79+
</build>
80+
</project>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?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">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<artifactId>jhlite-test-maven-project</artifactId>
6+
<version>0.0.1</version>
7+
<name>Test project</name>
8+
<packaging>pom</packaging>
9+
10+
<properties>
11+
<json-web-token.version>0.11.5</json-web-token.version>
12+
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
13+
<spring-boot.version>2.7.1</spring-boot.version>
14+
</properties>
15+
16+
<dependencyManagement>
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.springdoc</groupId>
20+
<artifactId>springdoc-openapi-ui</artifactId>
21+
<version>${springdoc-openapi.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-dependencies</artifactId>
26+
<version>${spring-boot.version}</version>
27+
<scope>import</scope>
28+
<type>pom</type>
29+
</dependency>
30+
</dependencies>
31+
</dependencyManagement>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>net.logstash.logback</groupId>
36+
<artifactId>logstash-logback-encoder</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.boot</groupId>
40+
<artifactId>spring-boot-starter-parent</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>io.jsonwebtoken</groupId>
44+
<artifactId>jjwt-api</artifactId>
45+
<version>${json-web-token.version}</version>
46+
<classifier>classif</classifier>
47+
<scope>test</scope>
48+
<optional>true</optional>
49+
</dependency>
50+
</dependencies>
51+
52+
<build>
53+
<plugins>
54+
<plugin>
55+
<groupId>org.springframework.boot</groupId>
56+
<artifactId>spring-boot-maven-plugin</artifactId>
57+
</plugin>
58+
</plugins>
59+
<pluginManagement>
60+
<plugins>
61+
<plugin>
62+
<groupId>org.springframework.boot</groupId>
63+
<artifactId>spring-boot-maven-plugin</artifactId>
64+
<version>${spring-boot.version}</version>
65+
<executions>
66+
<execution>
67+
<goals>
68+
<goal>repackage</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
<configuration>
73+
<mainClass>${start-class}</mainClass>
74+
</configuration>
75+
</plugin>
76+
</plugins>
77+
</pluginManagement>
78+
</build>
79+
</project>

src/test/java/io/fabric8/maven/MavenTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import org.junit.jupiter.api.DisplayNameGenerator;
2626
import org.junit.jupiter.api.Test;
2727
import org.junit.jupiter.api.io.TempDir;
28+
import org.junit.jupiter.params.ParameterizedTest;
29+
import org.junit.jupiter.params.provider.ValueSource;
2830
import org.xmlunit.assertj.XmlAssert;
2931

3032
/**
@@ -359,4 +361,18 @@ void should_not_add_extra_line_break() throws Exception {
359361
Maven.writeModel(model, sw);
360362
Approvals.verify(sw.toString());
361363
}
364+
365+
@ValueSource(strings = {"extra-line-pom.xml", "extra-line-pom_alt.xml"})
366+
@ParameterizedTest
367+
void should_not_add_extra_line_break_alt(String inputFile) throws Exception {
368+
Path pom = Paths.get(getClass().getResource(inputFile).toURI());
369+
Model model = Maven.readModel(pom);
370+
Dependency dependency = new Dependency();
371+
dependency.setGroupId("org.springframework.boot");
372+
dependency.setArtifactId("spring-boot-starter-parent");
373+
model.getDependencies().add(1, dependency);
374+
StringWriter sw = new StringWriter();
375+
Maven.writeModel(model, sw);
376+
Approvals.verify(sw.toString(), Approvals.NAMES.withParameters(inputFile));
377+
}
362378
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?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">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<artifactId>jhlite-test-maven-project</artifactId>
6+
<version>0.0.1</version>
7+
<name>Test project</name>
8+
<packaging>pom</packaging>
9+
10+
<properties>
11+
<json-web-token.version>0.11.5</json-web-token.version>
12+
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
13+
<spring-boot.version>2.7.1</spring-boot.version>
14+
</properties>
15+
16+
<dependencyManagement>
17+
<dependencies>
18+
<dependency>
19+
<groupId>org.springdoc</groupId>
20+
<artifactId>springdoc-openapi-ui</artifactId>
21+
<version>${springdoc-openapi.version}</version>
22+
</dependency>
23+
<dependency>
24+
<groupId>org.springframework.boot</groupId>
25+
<artifactId>spring-boot-dependencies</artifactId>
26+
<version>${spring-boot.version}</version>
27+
<scope>import</scope>
28+
<type>pom</type>
29+
</dependency>
30+
</dependencies>
31+
</dependencyManagement>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>net.logstash.logback</groupId>
36+
<artifactId>logstash-logback-encoder</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>io.jsonwebtoken</groupId>
40+
<artifactId>jjwt-api</artifactId>
41+
<version>${json-web-token.version}</version>
42+
<classifier>classif</classifier>
43+
<scope>test</scope>
44+
<optional>true</optional>
45+
</dependency>
46+
</dependencies>
47+
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.springframework.boot</groupId>
52+
<artifactId>spring-boot-maven-plugin</artifactId>
53+
</plugin>
54+
</plugins>
55+
<pluginManagement>
56+
<plugins>
57+
<plugin>
58+
<groupId>org.springframework.boot</groupId>
59+
<artifactId>spring-boot-maven-plugin</artifactId>
60+
<version>${spring-boot.version}</version>
61+
<executions>
62+
<execution>
63+
<goals>
64+
<goal>repackage</goal>
65+
</goals>
66+
</execution>
67+
</executions>
68+
<configuration>
69+
<mainClass>${start-class}</mainClass>
70+
</configuration>
71+
</plugin>
72+
</plugins>
73+
</pluginManagement>
74+
</build>
75+
</project>

0 commit comments

Comments
 (0)