[JAVA-1660] Upgrade JUnit and Maven Surefire Plugin in guava modules (#9477)

* [JAVA-1660] Upgrade JUnit and Maven Surefire Plugin versions in guava-modules

* Set guava-modules parent pom's parent to parent-java and submodules' parent to guava-modules parent

* Upgraded Maven Surefire Plugin version to 2.22.2

* Upgraded JUnit version to 5.6.2

* [JAVA-1660] Upgrade JUnit and Maven Surefire Plugin versions in guava

* Upgraded Maven Surefire Plugin version to 2.22.2

* Upgraded JUnit version to 5.6.2

* [JAVA-1660] Upgrade JUnit and Maven Surefire Plugin versions in guava-collections

* Upgraded Maven Surefire Plugin version to 2.22.2

* Upgraded JUnit version to 5.6.2

* [JAVA-1660] Upgrade JUnit and Maven Surefire Plugin versions in guava-collections-map

* Upgraded Maven Surefire Plugin version to 2.22.2

* Upgraded JUnit version to 5.6.2

* [JAVA-1660] Upgrade JUnit and Maven Surefire Plugin versions in guava-collections-set

* Upgraded Maven Surefire Plugin version to 2.22.2

* Upgraded JUnit version to 5.6.2

* [JAVA-1660] Upgraded JUnit and Maven Surefire Plugin in guava-io module

* Fixed project structure and added missing resources to make tests work

* Upgraded Maven Surefire Plugin to version 2.22.2

* Upgraded JUnit version to 5.6.2
This commit is contained in:
François Dupire 2020-06-13 11:11:35 +02:00 committed by GitHub
parent ca9ab77e7c
commit 3e6f576265
14 changed files with 204 additions and 34 deletions

View File

@ -16,12 +16,39 @@
<build>
<finalName>guava-collections-map</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
</properties>
</project>

View File

@ -13,8 +13,32 @@
<relativePath>../parent-java</relativePath>
</parent>
<build>
<finalName>guava-collections-set</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- test scoped -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
@ -23,13 +47,10 @@
</dependency>
</dependencies>
<build>
<finalName>guava-collections-set</finalName>
</build>
<properties>
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
</properties>
</project>

View File

@ -15,6 +15,25 @@
<relativePath>../parent-java</relativePath>
</parent>
<build>
<finalName>guava-collections</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<!-- utils -->
<dependency>
@ -27,7 +46,20 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
@ -44,16 +76,6 @@
</dependency>
</dependencies>
<build>
<finalName>guava-collections</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<!-- util -->
<commons-collections4.version>4.1</commons-collections4.version>
@ -61,6 +83,7 @@
<!-- testing -->
<assertj.version>3.6.1</assertj.version>
<java-hamcrest.version>2.0.0.0</java-hamcrest.version>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
</properties>
</project>

View File

@ -4,6 +4,9 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>guava-io</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
</properties>
<name>guava-io</name>
<parent>
@ -15,12 +18,35 @@
<build>
<finalName>guava-io</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -11,8 +11,11 @@ import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import org.junit.After;
import org.junit.Test;
import com.google.common.base.Charsets;
@ -31,6 +34,21 @@ import com.google.common.io.Resources;
public class GuavaIOUnitTest {
@After
public void afterEach() throws Exception {
deleteProducedFiles();
}
private void deleteProducedFiles() throws IOException {
deleteIfExists("test.out");
deleteIfExists("test_copy.in");
deleteIfExists("test_le.txt");
}
private void deleteIfExists(String fileName) throws IOException {
java.nio.file.Files.deleteIfExists(Paths.get("src", "test", "resources", fileName));
}
@Test
public void whenWriteUsingFiles_thenWritten() throws IOException {
final String expectedValue = "Hello world";
@ -206,5 +224,4 @@ public class GuavaIOUnitTest {
assertEquals(value, result);
}
}

View File

@ -0,0 +1 @@
Hello world

View File

@ -0,0 +1 @@
Test

View File

@ -0,0 +1,4 @@
John
Jane
Adam
Tom

View File

@ -8,9 +8,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<artifactId>guava-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
<relativePath>../</relativePath>
</parent>
<properties>

View File

@ -8,9 +8,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<artifactId>guava-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
<relativePath>../</relativePath>
</parent>
<properties>

View File

@ -8,9 +8,9 @@
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-java</artifactId>
<artifactId>guava-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../parent-java</relativePath>
<relativePath>../</relativePath>
</parent>
<dependencies>

View File

@ -4,13 +4,16 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>guava-modules</artifactId>
<name>guava-modules</name>
<properties>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
</properties>
<packaging>pom</packaging>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>..</relativePath>
<artifactId>parent-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-java</relativePath>
</parent>
<modules>
@ -19,4 +22,28 @@
<module>guava-21</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -15,13 +15,45 @@
<relativePath>../parent-java</relativePath>
</parent>
<build>
<finalName>guava</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- test scoped -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
@ -30,18 +62,9 @@
</dependency>
</dependencies>
<build>
<finalName>guava</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<!-- testing -->
<junit-jupiter.version>5.6.2</junit-jupiter.version>
<assertj.version>3.6.1</assertj.version>
</properties>