-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resort sources to have module-info.java first (#193)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=569833 Co-authored-by: Piotrek Żygieło <[email protected]>
- Loading branch information
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...r-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompilerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.codehaus.plexus.compiler.eclipse; | ||
|
||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.jupiter.params.provider.MethodSource; | ||
|
||
import java.util.List; | ||
import java.util.stream.Stream; | ||
|
||
import static java.util.Arrays.asList; | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class EclipseJavaCompilerTest | ||
{ | ||
@ParameterizedTest | ||
@MethodSource( "sources" ) | ||
void testReorderedSources( List<String> expected, List<String> inputSources ) | ||
{ | ||
List<String> resorted = EclipseJavaCompiler.resortSourcesToPutModuleInfoFirst( inputSources ); | ||
|
||
assertEquals( expected, resorted ); | ||
} | ||
|
||
static Stream<Arguments> sources() | ||
{ | ||
List<String> expectedOrder = asList( | ||
"module-info.java", | ||
"plexus/A.java", | ||
"plexus/B.java", | ||
"eclipse/A.java" | ||
); | ||
|
||
List<String> moduleInfoAlreadyFirst = asList( | ||
"module-info.java", | ||
"plexus/A.java", | ||
"plexus/B.java", | ||
"eclipse/A.java" | ||
); | ||
|
||
List<String> moduleInfoSomewhereInTheMiddle = asList( | ||
"plexus/A.java", | ||
"module-info.java", | ||
"plexus/B.java", | ||
"eclipse/A.java" | ||
); | ||
|
||
List<String> moduleInfoAsLast = asList( | ||
"plexus/A.java", | ||
"plexus/B.java", | ||
"eclipse/A.java", | ||
"module-info.java" | ||
); | ||
|
||
return Stream.of( | ||
Arguments.arguments( expectedOrder, moduleInfoAlreadyFirst ), | ||
Arguments.arguments( expectedOrder, moduleInfoSomewhereInTheMiddle ), | ||
Arguments.arguments( expectedOrder, moduleInfoAsLast ) | ||
); | ||
} | ||
} |