This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch MJLINK-56_junit5 in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
commit fad177cf0f7d19f6be3d8696e5ca5cb3674c60a0 Author: Benjamin Marwell <bmarw...@apache.org> AuthorDate: Mon Nov 16 16:48:32 2020 +0100 [MJLINK-56] Use Junit5 imports, add display name, remove commented code. --- .../maven/plugins/jlink/AbstractJLinkMojoTest.java | 38 ++++++++-------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java b/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java index 85dd34c..55bd52e 100644 --- a/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jlink/AbstractJLinkMojoTest.java @@ -28,8 +28,9 @@ import java.util.Arrays; import java.util.Collections; import org.apache.maven.plugin.logging.Log; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; /** @@ -39,7 +40,7 @@ public class AbstractJLinkMojoTest { private AbstractJLinkMojo mojoMock; - @Before + @BeforeEach public void before() { this.mojoMock = mock( AbstractJLinkMojo.class, Mockito.CALLS_REAL_METHODS ); @@ -47,6 +48,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "convert should return single characters" ) public void convertShouldReturnSingleCharacter() { StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath( "x" ); @@ -54,6 +56,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "convert should two characters separated by path separator" ) public void convertShouldReturnTwoCharactersSeparatedByPathSeparator() { StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath( "x;a" ); @@ -61,6 +64,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "convert using differential delimiter should return two characters separated by path separator" ) public void convertUsingDifferentDelimiterShouldReturnTwoCharactersSeparatedByPathSeparator() { StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath( "x:a" ); @@ -68,6 +72,8 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "convertSeparatedModulePathToPlatformSeparatedModulePath() " + + "should return two characters separated by path separator" ) public void convertUsingMultipleDelimitersShouldReturnTwoCharactersSeparatedByPathSeparator() { StringBuilder result = mojoMock.convertSeparatedModulePathToPlatformSeparatedModulePath( "x:a::" ); @@ -75,6 +81,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "getPlatformDependSeparateList() should return a single character" ) public void getPlatformDependSeparateListShouldReturnASingleCharacter() { String result = mojoMock.getPlatformDependSeparateList( Collections.singletonList( "A" ) ); @@ -82,6 +89,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "getPlatformDependSeparateList() should return two characters separated" ) public void getPlatformDependSeparateListShouldReturnTwoCharactersSeparated() { String result = mojoMock.getPlatformDependSeparateList( Arrays.asList( "A", "B" ) ); @@ -89,6 +97,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "getPlatformDependSeparateList() should return three characters separated" ) public void getPlatformDependSeparateListShouldReturnThreeCharactersSeparated() { String result = mojoMock.getPlatformDependSeparateList( Arrays.asList( "A", "B", "C" ) ); @@ -96,6 +105,7 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "getCommaSeparatedList() should return a single character" ) public void getCommaSeparatedListShouldReturnASingleCharacter() { String result = mojoMock.getCommaSeparatedList( Arrays.asList( "A" ) ); @@ -103,31 +113,11 @@ public class AbstractJLinkMojoTest } @Test + @DisplayName( "getCommaSeparatedList() should return two characters separated by comma" ) public void getCommaSeparatedListShouldReturnTwoCharactersSeparatedByComma() { String result = mojoMock.getCommaSeparatedList( Arrays.asList( "A", "B" ) ); assertThat( result ).isEqualTo( "A,B" ); } -// @Test -// public void xxx() -// throws MojoExecutionException, IOException, CommandLineException -// { -// Process p = mock( Process.class ); -// -// String b = "Error occured"; -// byte[] bytes = b.getBytes(); -// ByteArrayOutputStream baos = new ByteArrayOutputStream(); -// baos.write( bytes ); -// -// when (p.getOutputStream()).thenReturn( baos ); -// -// Commandline cmd = mock( Commandline.class ); -// when (cmd.execute()).thenReturn( p ); -// -// File outputDirectory = mock( File.class ); -// -// mojoMock.executeCommand( cmd, outputDirectory ); -// -// } }