NEWLINE_TEXT_WRAPPER_INSTANCE =
+ new UnsortedWrapper<>(NewlineText.INSTANCE);
/** The wrapped dom content. */
private final T content;
diff --git a/sorter/src/test/java/sortpom/parameter/EncodingParameterTest.java b/sorter/src/test/java/sortpom/parameter/EncodingParameterTest.java
index 426cb696..7a6a7357 100644
--- a/sorter/src/test/java/sortpom/parameter/EncodingParameterTest.java
+++ b/sorter/src/test/java/sortpom/parameter/EncodingParameterTest.java
@@ -68,7 +68,7 @@ void illegalEncodingWhenSavingPomFileShouldNotWork() throws IOException {
}
@Test
- void differentEncodingShouldWork1() throws Exception {
+ void differentEncodingShouldWork1() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.encoding("UTF-32BE")
@@ -76,7 +76,7 @@ void differentEncodingShouldWork1() throws Exception {
}
@Test
- void differentEncodingShouldWork2() throws Exception {
+ void differentEncodingShouldWork2() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.encoding("UTF-16")
@@ -84,7 +84,7 @@ void differentEncodingShouldWork2() throws Exception {
}
@Test
- void differentEncodingShouldWork3() throws Exception {
+ void differentEncodingShouldWork3() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.encoding("ISO-8859-1")
diff --git a/sorter/src/test/java/sortpom/parameter/IgnoreLineSeparatorsTest.java b/sorter/src/test/java/sortpom/parameter/IgnoreLineSeparatorsTest.java
index 1100b212..960f0536 100644
--- a/sorter/src/test/java/sortpom/parameter/IgnoreLineSeparatorsTest.java
+++ b/sorter/src/test/java/sortpom/parameter/IgnoreLineSeparatorsTest.java
@@ -6,7 +6,7 @@
class IgnoreLineSeparatorsTest {
@Test
- void ignoringLineSeparatorsShouldNotSort() throws Exception {
+ void ignoringLineSeparatorsShouldNotSort() {
SortPomImplUtil.create()
.lineSeparator("\n")
.ignoreLineSeparators(true)
@@ -14,7 +14,7 @@ void ignoringLineSeparatorsShouldNotSort() throws Exception {
}
@Test
- void doNotIgnoreLineSeparatorsShouldSort() throws Exception {
+ void doNotIgnoreLineSeparatorsShouldSort() {
SortPomImplUtil.create()
.lineSeparator("\n")
.ignoreLineSeparators(false)
diff --git a/sorter/src/test/java/sortpom/parameter/KeepTimestampParameterTest.java b/sorter/src/test/java/sortpom/parameter/KeepTimestampParameterTest.java
index 51a5f8af..a1b04720 100644
--- a/sorter/src/test/java/sortpom/parameter/KeepTimestampParameterTest.java
+++ b/sorter/src/test/java/sortpom/parameter/KeepTimestampParameterTest.java
@@ -6,7 +6,7 @@
class KeepTimestampParameterTest {
@Test
- void whenKeepTimestampNotSetTimestampsShouldDiffer() throws Exception {
+ void whenKeepTimestampNotSetTimestampsShouldDiffer() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.lineSeparator("\n")
@@ -16,7 +16,7 @@ void whenKeepTimestampNotSetTimestampsShouldDiffer() throws Exception {
}
@Test
- void whenKeepTimestampIsSetTimestampsShouldRemain() throws Exception {
+ void whenKeepTimestampIsSetTimestampsShouldRemain() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.lineSeparator("\n")
diff --git a/sorter/src/test/java/sortpom/parameter/SortOrderFilesParameterTest.java b/sorter/src/test/java/sortpom/parameter/SortOrderFilesParameterTest.java
index a2519037..7395ea56 100644
--- a/sorter/src/test/java/sortpom/parameter/SortOrderFilesParameterTest.java
+++ b/sorter/src/test/java/sortpom/parameter/SortOrderFilesParameterTest.java
@@ -7,7 +7,6 @@
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import java.lang.reflect.InvocationTargetException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import sortpom.exception.FailureException;
@@ -52,11 +51,10 @@ void incorrectCustomSortOrderShouldThrowException2() {
.customSortOrderFile("difforder/VERYdifferentOrder.xml")
.testVerifyXmlIsOrdered("/sortOrderFiles/sorted_differentOrder.xml");
- var thrown = assertThrows(InvocationTargetException.class, testMethod);
+ var thrown = assertThrows(RuntimeException.class, testMethod).getCause().getCause();
- var cause = thrown.getTargetException();
- assertThat(cause, isA(FailureException.class));
- assertThat(cause.getMessage(), endsWith("VERYdifferentOrder.xml in classpath"));
+ assertThat(thrown, isA(FailureException.class));
+ assertThat(thrown.getMessage(), endsWith("VERYdifferentOrder.xml in classpath"));
}
@Test
@@ -68,12 +66,11 @@ void incorrectPredefinedSortOrderShouldThrowException2() {
.lineSeparator("\n")
.testVerifyXmlIsOrdered("/sortOrderFiles/sorted_default_0_4_0.xml");
- var thrown = assertThrows(InvocationTargetException.class, testMethod);
+ var thrown = assertThrows(RuntimeException.class, testMethod).getCause().getCause();
- var cause = thrown.getTargetException();
- assertThat(cause, isA(IllegalArgumentException.class));
+ assertThat(thrown, isA(IllegalArgumentException.class));
assertThat(
- cause.getMessage(),
+ thrown.getMessage(),
is(equalTo("Cannot find abbie_normal_brain.xml among the predefined plugin resources")));
}
}
diff --git a/sorter/src/test/java/sortpom/parameter/ViolationFileParameterTest.java b/sorter/src/test/java/sortpom/parameter/ViolationFileParameterTest.java
index 20e812cd..1d0769cb 100644
--- a/sorter/src/test/java/sortpom/parameter/ViolationFileParameterTest.java
+++ b/sorter/src/test/java/sortpom/parameter/ViolationFileParameterTest.java
@@ -78,7 +78,7 @@ void violationFileShouldBeCreatedOnVerificationStop() {
}
@Test
- void violationFileWithParentDirectoryShouldBeCreatedOnVerificationWarn() throws Exception {
+ void violationFileWithParentDirectoryShouldBeCreatedOnVerificationWarn() {
SortPomImplUtil.create()
.verifyFail("Warn")
.violationFile(FILENAME_WITH_DIRECTORIES)
diff --git a/sorter/src/test/java/sortpom/sort/EndWithNewlineTest.java b/sorter/src/test/java/sortpom/sort/EndWithNewlineTest.java
index 108d1ba7..a822fa9e 100644
--- a/sorter/src/test/java/sortpom/sort/EndWithNewlineTest.java
+++ b/sorter/src/test/java/sortpom/sort/EndWithNewlineTest.java
@@ -5,7 +5,7 @@
class EndWithNewlineTest {
@Test
- void endWithNewlineFalseShouldNotOutputFinalNewline() throws Exception {
+ void endWithNewlineFalseShouldNotOutputFinalNewline() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.endWithNewlineFalse()
diff --git a/sorter/src/test/java/sortpom/sort/IgnoreSectionsTest.java b/sorter/src/test/java/sortpom/sort/IgnoreSectionsTest.java
index bbd3e653..78145170 100644
--- a/sorter/src/test/java/sortpom/sort/IgnoreSectionsTest.java
+++ b/sorter/src/test/java/sortpom/sort/IgnoreSectionsTest.java
@@ -5,7 +5,7 @@
class IgnoreSectionsTest {
@Test
- void forceDependencyToTopTrickShouldWork() throws Exception {
+ void forceDependencyToTopTrickShouldWork() {
SortPomImplUtil.create()
.sortDependencies("scope,groupId,artifactId")
.lineSeparator("\n")
diff --git a/sorter/src/test/java/sortpom/sort/IndentationTest.java b/sorter/src/test/java/sortpom/sort/IndentationTest.java
index 9160c635..875f21f2 100644
--- a/sorter/src/test/java/sortpom/sort/IndentationTest.java
+++ b/sorter/src/test/java/sortpom/sort/IndentationTest.java
@@ -14,7 +14,7 @@ class IndentationTest {
@ParameterizedTest()
@ValueSource(ints = {0, 1, 4, -1})
- void differentIndentsShouldWork(int indent) throws Exception {
+ void differentIndentsShouldWork(int indent) {
var expectedFile = "/SortModules_expectedIndent" + indent + ".xml";
SortPomImplUtil.create()
.sortProperties()
@@ -28,7 +28,7 @@ void differentIndentsShouldWork(int indent) throws Exception {
@ParameterizedTest()
@ValueSource(ints = {0, 1, 4, -1})
- void indentSchemaLocationShouldBeIndentTimesTwoPlusOne(int indent) throws Exception {
+ void indentSchemaLocationShouldBeIndentTimesTwoPlusOne(int indent) {
var expectedFile = "/SortModules_expectedSchemaIndent" + indent + ".xml";
SortPomImplUtil.create()
.sortProperties()
@@ -73,7 +73,7 @@ void indentSchemaLocationShouldAddNewlineAndIndentation(int indent) {
+ lineSeparator
+ indentChars
+ indentChars
- + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">"
+ + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ lineSeparator
+ indentChars
+ ""
@@ -106,7 +106,7 @@ void otherAttributeShouldNotBeIndented() {
+ lineSeparator
+ indentChars
+ indentChars
- + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">"
+ + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd\">"
+ lineSeparator
+ indentChars
+ ""
diff --git a/sorter/src/test/java/sortpom/sort/KeepBlankLinesTest.java b/sorter/src/test/java/sortpom/sort/KeepBlankLinesTest.java
index 96841453..90e07173 100644
--- a/sorter/src/test/java/sortpom/sort/KeepBlankLinesTest.java
+++ b/sorter/src/test/java/sortpom/sort/KeepBlankLinesTest.java
@@ -9,7 +9,7 @@
class KeepBlankLinesTest {
@Test
- void emptyRowsInSimplePomShouldBePreserved() throws Exception {
+ void emptyRowsInSimplePomShouldBePreserved() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testInputAndExpected(
@@ -17,7 +17,7 @@ void emptyRowsInSimplePomShouldBePreserved() throws Exception {
}
@Test
- void emptyRowsInLargePomShouldBePreserved1() throws Exception {
+ void emptyRowsInLargePomShouldBePreserved1() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testInputAndExpected(
@@ -26,7 +26,7 @@ void emptyRowsInLargePomShouldBePreserved1() throws Exception {
}
@Test
- void emptyRowsInLargePomShouldBePreservedAndIndented1() throws Exception {
+ void emptyRowsInLargePomShouldBePreservedAndIndented1() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.indentBlankLines()
@@ -36,14 +36,14 @@ void emptyRowsInLargePomShouldBePreservedAndIndented1() throws Exception {
}
@Test
- void emptyRowsInLargePomShouldBePreserved2() throws Exception {
+ void emptyRowsInLargePomShouldBePreserved2() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testFiles("/Real1_input.xml", "/Real1_expected_keepBlankLines.xml");
}
@Test
- void emptyRowsInLargePomShouldBePreservedAndIndented2() throws Exception {
+ void emptyRowsInLargePomShouldBePreservedAndIndented2() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.indentBLankLines()
@@ -51,14 +51,14 @@ void emptyRowsInLargePomShouldBePreservedAndIndented2() throws Exception {
}
@Test
- void simpleLineBreaksShouldNotBePreserved() throws Exception {
+ void simpleLineBreaksShouldNotBePreserved() {
XmlProcessorTestUtil.create()
.testInputAndExpected(
"src/test/resources/LineBreak_input.xml", "src/test/resources/Character_expected.xml");
}
@Test
- void allLineBreaksInXmlShouldBeNewlines() throws Exception {
+ void allLineBreaksInXmlShouldBeNewlines() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\n")
@@ -71,7 +71,7 @@ void allLineBreaksInXmlShouldBeNewlines() throws Exception {
}
@Test
- void allLineBreaksInXmlShouldBeCarriageReturnNewlines() throws Exception {
+ void allLineBreaksInXmlShouldBeCarriageReturnNewlines() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\r\n")
@@ -84,7 +84,7 @@ void allLineBreaksInXmlShouldBeCarriageReturnNewlines() throws Exception {
}
@Test
- void allLineBreaksInXmlShouldBeCarriageReturn() throws Exception {
+ void allLineBreaksInXmlShouldBeCarriageReturn() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\r")
@@ -97,7 +97,7 @@ void allLineBreaksInXmlShouldBeCarriageReturn() throws Exception {
}
@Test
- void allLineBreaksInXmlShouldBeNewlines2() throws Exception {
+ void allLineBreaksInXmlShouldBeNewlines2() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\n")
@@ -110,7 +110,7 @@ void allLineBreaksInXmlShouldBeNewlines2() throws Exception {
}
@Test
- void allLineBreaksInXmlShouldBeCarriageReturnNewlines2() throws Exception {
+ void allLineBreaksInXmlShouldBeCarriageReturnNewlines2() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\r\n")
@@ -123,7 +123,7 @@ void allLineBreaksInXmlShouldBeCarriageReturnNewlines2() throws Exception {
}
@Test
- void allLineBreaksInXmlShouldBeCarriageReturn2() throws Exception {
+ void allLineBreaksInXmlShouldBeCarriageReturn2() {
var actual =
XmlProcessorTestUtil.create()
.lineSeparator("\r")
@@ -136,7 +136,7 @@ void allLineBreaksInXmlShouldBeCarriageReturn2() throws Exception {
}
@Test
- void artifactIdsWithLineBreaksShouldBeTrimmedBeforeSorting() throws Exception {
+ void artifactIdsWithLineBreaksShouldBeTrimmedBeforeSorting() {
XmlProcessorTestUtil.create()
.lineSeparator("\n")
.expandEmptyElements(false)
@@ -151,7 +151,7 @@ void artifactIdsWithLineBreaksShouldBeTrimmedBeforeSorting() throws Exception {
}
@Test
- void emptyRowsInLargePomShouldNotBePreserved() throws Exception {
+ void emptyRowsInLargePomShouldNotBePreserved() {
XmlProcessorTestUtil.create()
.keepBlankLinesFalse()
.testInputAndExpected(
diff --git a/sorter/src/test/java/sortpom/sort/KeepTrailingCommentsTest.java b/sorter/src/test/java/sortpom/sort/KeepTrailingCommentsTest.java
index 6464a0f0..52f3ed66 100644
--- a/sorter/src/test/java/sortpom/sort/KeepTrailingCommentsTest.java
+++ b/sorter/src/test/java/sortpom/sort/KeepTrailingCommentsTest.java
@@ -5,7 +5,7 @@
class KeepTrailingCommentsTest {
@Test
- void commentsInIgnoreSectionShouldNotBeFormatted() throws Exception {
+ void commentsInIgnoreSectionShouldNotBeFormatted() {
SortPomImplUtil.create()
.sortDependencies("scope,groupId,artifactId")
.lineSeparator("\r\n")
diff --git a/sorter/src/test/java/sortpom/sort/LineSeparatorTest.java b/sorter/src/test/java/sortpom/sort/LineSeparatorTest.java
index 04d841a0..ecf4ebec 100644
--- a/sorter/src/test/java/sortpom/sort/LineSeparatorTest.java
+++ b/sorter/src/test/java/sortpom/sort/LineSeparatorTest.java
@@ -29,9 +29,16 @@ void formattingXmlWithLineEndingsShouldResultInOneLineBreakAtEnd(String lineSepa
}
@Test
- void linesInContentShouldBePreserved() throws Exception {
+ void linesInContentShouldBePreserved() {
SortPomImplUtil.create()
.lineSeparator("\r\n")
.testFiles("/MultilineContent_input.xml", "/MultilineContent_expected.xml");
}
+
+ @Test
+ void spaceInPreservedXmlShouldNotBeTrimmed() {
+ SortPomImplUtil.create()
+ .lineSeparator("\r\n")
+ .testFiles("/PreserveContent_input.xml", "/PreserveContent_output.xml");
+ }
}
diff --git a/sorter/src/test/java/sortpom/sort/ReportPluginsTest.java b/sorter/src/test/java/sortpom/sort/ReportPluginsTest.java
index a15a4c21..8d5cec73 100644
--- a/sorter/src/test/java/sortpom/sort/ReportPluginsTest.java
+++ b/sorter/src/test/java/sortpom/sort/ReportPluginsTest.java
@@ -6,7 +6,7 @@
class ReportPluginsTest {
@Test
- void sortReportPluginsByArtifactIdWithCustomSortOrderFileShouldWork() throws Exception {
+ void sortReportPluginsByArtifactIdWithCustomSortOrderFileShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/custom_report_plugins.xml")
.lineSeparator("\r\n")
@@ -15,7 +15,7 @@ void sortReportPluginsByArtifactIdWithCustomSortOrderFileShouldWork() throws Exc
}
@Test
- void sortReportPluginsByGroupIdWithCustomSortOrderFileShouldWork() throws Exception {
+ void sortReportPluginsByGroupIdWithCustomSortOrderFileShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/custom_report_plugins.xml")
.lineSeparator("\r\n")
diff --git a/sorter/src/test/java/sortpom/sort/SortDepManagementExclusionsTest.java b/sorter/src/test/java/sortpom/sort/SortDepManagementExclusionsTest.java
index 3da7e7b2..474aa4c8 100644
--- a/sorter/src/test/java/sortpom/sort/SortDepManagementExclusionsTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortDepManagementExclusionsTest.java
@@ -6,7 +6,7 @@
class SortDepManagementExclusionsTest {
@Test
- void sortGroupIdForExclusionsShouldWork() throws Exception {
+ void sortGroupIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("groupId")
@@ -18,7 +18,7 @@ void sortGroupIdForExclusionsShouldWork() throws Exception {
}
@Test
- void sortArtifactIdForExclusionsShouldWork() throws Exception {
+ void sortArtifactIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("artifactId")
@@ -30,7 +30,7 @@ void sortArtifactIdForExclusionsShouldWork() throws Exception {
}
@Test
- void sortGroupIdAndArtifactIdForExclusionsShouldWork() throws Exception {
+ void sortGroupIdAndArtifactIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/sort/SortDependenciesTest.java b/sorter/src/test/java/sortpom/sort/SortDependenciesTest.java
index 2a33c732..936f114a 100644
--- a/sorter/src/test/java/sortpom/sort/SortDependenciesTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortDependenciesTest.java
@@ -12,7 +12,7 @@
class SortDependenciesTest {
@Test
- void scopeInSortDependenciesShouldSortByScope() throws Exception {
+ void scopeInSortDependenciesShouldSortByScope() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencies("scope,GROUPID,artifactId")
@@ -24,11 +24,11 @@ void scopeInSortDependenciesShouldSortByScope() throws Exception {
* This is an odd test since we add an EXTRA tag in the SORT ORDER FILE (under plugins and
* dependencies) so that it will be sorted beside dependency and plugin tags.
*
- * The extra tag does not play well with the pom xml validation. Also unknown tags should be
+ *
The extra tag does not play well with the pom xml validation. Also, unknown tags should be
* placed last.
*/
@Test
- void extraTagInDependenciesPluginAndExclusionsShouldBeSortedFirst() throws Exception {
+ void extraTagInDependenciesPluginAndExclusionsShouldBeSortedFirst() {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/extra_dummy_tags.xml")
.sortDependencies("scope,groupId,artifactId")
@@ -39,7 +39,7 @@ void extraTagInDependenciesPluginAndExclusionsShouldBeSortedFirst() throws Excep
}
@Test
- void defaultGroupIdForPluginsShouldWork() throws Exception {
+ void defaultGroupIdForPluginsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortPlugins("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/sort/SortDependencyExclusionsTest.java b/sorter/src/test/java/sortpom/sort/SortDependencyExclusionsTest.java
index 0856a686..186484ce 100644
--- a/sorter/src/test/java/sortpom/sort/SortDependencyExclusionsTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortDependencyExclusionsTest.java
@@ -50,7 +50,7 @@ void deprecatedSortPluginsFalseMessageShouldWork() {
}
@Test
- void sortGroupIdForExclusionsShouldWork() throws Exception {
+ void sortGroupIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("groupId")
@@ -60,7 +60,7 @@ void sortGroupIdForExclusionsShouldWork() throws Exception {
}
@Test
- void sortArtifactIdForExclusionsShouldWork() throws Exception {
+ void sortArtifactIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("artifactId")
@@ -70,7 +70,7 @@ void sortArtifactIdForExclusionsShouldWork() throws Exception {
}
@Test
- void sortGroupIdAndArtifactIdForExclusionsShouldWork() throws Exception {
+ void sortGroupIdAndArtifactIdForExclusionsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyExclusions("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/sort/SortDependencyManagementTests.java b/sorter/src/test/java/sortpom/sort/SortDependencyManagementTests.java
index 87f4885f..21868f9d 100644
--- a/sorter/src/test/java/sortpom/sort/SortDependencyManagementTests.java
+++ b/sorter/src/test/java/sortpom/sort/SortDependencyManagementTests.java
@@ -6,7 +6,7 @@
class SortDependencyManagementTests {
@Test
- void scopeInSortDependencyManagementShouldSortByScope() throws Exception {
+ void scopeInSortDependencyManagementShouldSortByScope() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyManagement("scope,GROUPID,artifactId")
@@ -17,7 +17,7 @@ void scopeInSortDependencyManagementShouldSortByScope() throws Exception {
}
@Test
- void defaultDependencyManagementShouldWork() throws Exception {
+ void defaultDependencyManagementShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencies("scope,GROUPID,artifactId")
@@ -28,7 +28,7 @@ void defaultDependencyManagementShouldWork() throws Exception {
}
@Test
- void differentOrderBetweenDepAndDepManagement() throws Exception {
+ void differentOrderBetweenDepAndDepManagement() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencies("scope,GROUPID,artifactId")
@@ -40,7 +40,7 @@ void differentOrderBetweenDepAndDepManagement() throws Exception {
}
@Test
- void dependencyManagementShouldBeUnaffected() throws Exception {
+ void dependencyManagementShouldBeUnaffected() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencies("scope,GROUPID,artifactId")
@@ -52,7 +52,7 @@ void dependencyManagementShouldBeUnaffected() throws Exception {
}
@Test
- void onlySortDependencyManagementShouldNotAffectNormalDependencies() throws Exception {
+ void onlySortDependencyManagementShouldNotAffectNormalDependencies() {
SortPomImplUtil.create()
.customSortOrderFile("custom_1.xml")
.sortDependencyManagement("scope")
diff --git a/sorter/src/test/java/sortpom/sort/SortExecutionsTest.java b/sorter/src/test/java/sortpom/sort/SortExecutionsTest.java
index c7821042..f2b63ca8 100644
--- a/sorter/src/test/java/sortpom/sort/SortExecutionsTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortExecutionsTest.java
@@ -1 +1 @@
-package sortpom.sort;
import org.junit.jupiter.api.Test;
import sortpom.util.SortPomImplUtil;
class SortExecutionsTest {
@Test
void sortPhaseAndThenId() throws Exception {
SortPomImplUtil.create()
.sortExecutions()
.lineSeparator("\r\n")
.testFiles("/SortExec_input_simpleWithPhase.xml", "/SortExec_expect_simpleWithPhase.xml");
}
@Test
void doNotSortIfPhaseAndIdIsSame() throws Exception {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/extra_dummy_tags.xml")
.sortExecutions()
.lineSeparator("\r\n")
.testFiles("/SortExec_input_complexWithPhase.xml", "/SortExec_expect_complexWithPhase.xml");
}
}
\ No newline at end of file
+package sortpom.sort;
import org.junit.jupiter.api.Test;
import sortpom.util.SortPomImplUtil;
class SortExecutionsTest {
@Test
void sortPhaseAndThenId() {
SortPomImplUtil.create()
.sortExecutions()
.lineSeparator("\r\n")
.testFiles("/SortExec_input_simpleWithPhase.xml", "/SortExec_expect_simpleWithPhase.xml");
}
@Test
void doNotSortIfPhaseAndIdIsSame() {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/extra_dummy_tags.xml")
.sortExecutions()
.lineSeparator("\r\n")
.testFiles("/SortExec_input_complexWithPhase.xml", "/SortExec_expect_complexWithPhase.xml");
}
}
\ No newline at end of file
diff --git a/sorter/src/test/java/sortpom/sort/SortModulesTest.java b/sorter/src/test/java/sortpom/sort/SortModulesTest.java
index f4fefd73..85f8f0ab 100644
--- a/sorter/src/test/java/sortpom/sort/SortModulesTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortModulesTest.java
@@ -5,7 +5,7 @@
class SortModulesTest {
@Test
- void sortingOfPomFileWithSubmodulesShouldWork() throws Exception {
+ void sortingOfPomFileWithSubmodulesShouldWork() {
SortPomImplUtil.create()
.sortProperties()
.sortPlugins("groupId,artifactId")
@@ -16,7 +16,7 @@ void sortingOfPomFileWithSubmodulesShouldWork() throws Exception {
}
@Test
- void sortingOfPomFileWithSubmodulesAndExtraElementsShouldWork() throws Exception {
+ void sortingOfPomFileWithSubmodulesAndExtraElementsShouldWork() {
SortPomImplUtil.create()
.customSortOrderFile("sortOrderFiles/extra_dummy_tags.xml")
.sortProperties()
@@ -29,7 +29,7 @@ void sortingOfPomFileWithSubmodulesAndExtraElementsShouldWork() throws Exception
}
@Test
- void sortingOfPomFileWithSubmodulesNotEnabled() throws Exception {
+ void sortingOfPomFileWithSubmodulesNotEnabled() {
SortPomImplUtil.create()
.sortProperties()
.sortPlugins("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/sort/SortOrderFilesTest.java b/sorter/src/test/java/sortpom/sort/SortOrderFilesTest.java
index 149af129..97fd90c5 100644
--- a/sorter/src/test/java/sortpom/sort/SortOrderFilesTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortOrderFilesTest.java
@@ -12,7 +12,7 @@
class SortOrderFilesTest {
@Test
- void correctCustomSortOrderShouldSortThePm() throws Exception {
+ void correctCustomSortOrderShouldSortThePm() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.lineSeparator("\n")
@@ -20,7 +20,7 @@ void correctCustomSortOrderShouldSortThePm() throws Exception {
}
@Test
- void default040ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void default040ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.lineSeparator("\n")
@@ -28,7 +28,7 @@ void default040ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void custom1ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void custom1ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("custom_1")
.lineSeparator("\n")
@@ -36,7 +36,7 @@ void custom1ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void recommended2008_06ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void recommended2008_06ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("recommended_2008_06")
.lineSeparator("\n")
@@ -44,7 +44,7 @@ void recommended2008_06ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void default100ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void default100ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("default_1_0_0")
.lineSeparator("\n")
@@ -73,7 +73,7 @@ void illegalPredefinedSortOrderShouldReportError() {
var thrown =
assertThrows(
- IllegalArgumentException.class,
+ RuntimeException.class,
() ->
sortPomImplUtil.testFiles(
"/full_unsorted_input.xml", "/sortOrderFiles/sorted_default_1_0_0.xml"));
@@ -84,7 +84,7 @@ void illegalPredefinedSortOrderShouldReportError() {
}
@Test
- void xmlDeviationsShouldNotHarmPlugin() throws Exception {
+ void xmlDeviationsShouldNotHarmPlugin() {
SortPomImplUtil.create()
.lineSeparator("\n")
.testFiles("/Xml_deviations_input.xml", "/Xml_deviations_output.xml");
diff --git a/sorter/src/test/java/sortpom/sort/SortOrderTest.java b/sorter/src/test/java/sortpom/sort/SortOrderTest.java
index fe0ed43b..ca9c0399 100644
--- a/sorter/src/test/java/sortpom/sort/SortOrderTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortOrderTest.java
@@ -14,66 +14,66 @@
class SortOrderTest {
@Test
- void testSortDifferentClassPath() throws Exception {
+ void testSortDifferentClassPath() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.testFiles("/full_unsorted_input.xml", "/full_differentorder_expected.xml");
}
@Test
- void testSortDifferentRelativePath() throws Exception {
+ void testSortDifferentRelativePath() {
SortPomImplUtil.create()
.customSortOrderFile("src/test/resources/difforder/differentOrder.xml")
.testFiles("/full_unsorted_input.xml", "/full_differentorder_expected.xml");
}
@Test
- void testSortXmlCharacter() throws Exception {
+ void testSortXmlCharacter() {
SortPomImplUtil.create().testFiles("/Character_input.xml", "/Character_expected.xml");
}
@Test
- void testSortXmlComplex() throws Exception {
+ void testSortXmlComplex() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testFiles("/Complex_input.xml", "/Complex_expected.xml");
}
@Test
- void testSortXmlFullFromAlphabeticalOrder() throws Exception {
+ void testSortXmlFullFromAlphabeticalOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testFiles("/full_alfa_input.xml", "/full_expected.xml");
}
@Test
- void testSortXmlFull() throws Exception {
+ void testSortXmlFull() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testFiles("/full_unsorted_input.xml", "/full_expected.xml");
}
@Test
- void testSortXmlReal1() throws Exception {
+ void testSortXmlReal1() {
SortPomImplUtil.create()
.noKeepBlankLines()
.testFiles("/Real1_input.xml", "/Real1_expected.xml");
}
@Test
- void testSortXmlSimple() throws Exception {
+ void testSortXmlSimple() {
SortPomImplUtil.create().testFiles("/Simple_input.xml", "/Simple_expected.xml");
}
@Test
- void testSortWithIndent() throws Exception {
+ void testSortWithIndent() {
SortPomImplUtil.create()
.nrOfIndentSpace(4)
.testFiles("/Simple_input.xml", "/Simple_expected_indent.xml");
}
@Test
- void testSortWithDependencySortSimple() throws Exception {
+ void testSortWithDependencySortSimple() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.sortPlugins("groupId,artifactId")
@@ -81,7 +81,7 @@ void testSortWithDependencySortSimple() throws Exception {
}
@Test
- void testSortWithDependencySortFull() throws Exception {
+ void testSortWithDependencySortFull() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.sortPlugins("groupId,artifactId")
@@ -89,7 +89,7 @@ void testSortWithDependencySortFull() throws Exception {
}
@Test
- void sortedFileShouldNotBeSorted() throws Exception {
+ void sortedFileShouldNotBeSorted() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.sortPlugins("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/sort/SortPropertiesTest.java b/sorter/src/test/java/sortpom/sort/SortPropertiesTest.java
index 4d278247..ca5579f4 100644
--- a/sorter/src/test/java/sortpom/sort/SortPropertiesTest.java
+++ b/sorter/src/test/java/sortpom/sort/SortPropertiesTest.java
@@ -6,7 +6,7 @@
class SortPropertiesTest {
@Test
- void namedParametersInSortFileShouldSortThemFirst() throws Exception {
+ void namedParametersInSortFileShouldSortThemFirst() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
.lineSeparator("\n")
@@ -14,7 +14,7 @@ void namedParametersInSortFileShouldSortThemFirst() throws Exception {
}
@Test
- void sortPropertyParameterShouldSortAlphabetically() throws Exception {
+ void sortPropertyParameterShouldSortAlphabetically() {
SortPomImplUtil.create()
.sortProperties()
.lineSeparator("\n")
@@ -23,7 +23,7 @@ void sortPropertyParameterShouldSortAlphabetically() throws Exception {
}
@Test
- void testBothNamedParametersInSortFileAndSortPropertyParameterTest() throws Exception {
+ void testBothNamedParametersInSortFileAndSortPropertyParameterTest() {
SortPomImplUtil.create()
.lineSeparator("\n")
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
@@ -32,7 +32,7 @@ void testBothNamedParametersInSortFileAndSortPropertyParameterTest() throws Exce
}
@Test
- void sortingOfFullPomFileShouldWork() throws Exception {
+ void sortingOfFullPomFileShouldWork() {
SortPomImplUtil.create()
.sortProperties()
.sortPlugins("groupId,artifactId")
@@ -42,7 +42,7 @@ void sortingOfFullPomFileShouldWork() throws Exception {
}
@Test
- void duplicatePropertiesShouldNotTriggerSorting() throws Exception {
+ void duplicatePropertiesShouldNotTriggerSorting() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.sortProperties()
diff --git a/sorter/src/test/java/sortpom/sort/XmlFragment.java b/sorter/src/test/java/sortpom/sort/XmlFragment.java
index 99ab2a13..0f9f7e32 100644
--- a/sorter/src/test/java/sortpom/sort/XmlFragment.java
+++ b/sorter/src/test/java/sortpom/sort/XmlFragment.java
@@ -19,7 +19,7 @@ public static Document createXmlProjectFragment() {
rootElement.setNamespace(Namespace.get("http://maven.apache.org/POM/4.0.0"));
rootElement.addAttribute(
new QName("schemaLocation", xsi),
- "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd");
+ "http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd");
rootElement.add(xsi);
rootElement.add(new BaseElement("Gurka"));
diff --git a/sorter/src/test/java/sortpom/sort/XmlProcessorTest.java b/sorter/src/test/java/sortpom/sort/XmlProcessorTest.java
index 0b735105..30ce3a64 100644
--- a/sorter/src/test/java/sortpom/sort/XmlProcessorTest.java
+++ b/sorter/src/test/java/sortpom/sort/XmlProcessorTest.java
@@ -6,7 +6,7 @@
class XmlProcessorTest {
@Test
- void testSortXmlAttributes() throws Exception {
+ void testSortXmlAttributes() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testInputAndExpected(
@@ -14,14 +14,14 @@ void testSortXmlAttributes() throws Exception {
}
@Test
- void testSortXmlCharacter() throws Exception {
+ void testSortXmlCharacter() {
XmlProcessorTestUtil.create()
.testInputAndExpected(
"src/test/resources/Character_input.xml", "src/test/resources/Character_expected.xml");
}
@Test
- void testSortXmlComplex() throws Exception {
+ void testSortXmlComplex() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testInputAndExpected(
@@ -29,7 +29,7 @@ void testSortXmlComplex() throws Exception {
}
@Test
- void testSortXmlFullFromAlphabeticalOrder() throws Exception {
+ void testSortXmlFullFromAlphabeticalOrder() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testInputAndExpected(
@@ -37,7 +37,7 @@ void testSortXmlFullFromAlphabeticalOrder() throws Exception {
}
@Test
- void testSortXmlFullToAlphabetical() throws Exception {
+ void testSortXmlFullToAlphabetical() {
XmlProcessorTestUtil.create()
.sortAlphabeticalOnly()
.testInputAndExpected(
@@ -45,7 +45,7 @@ void testSortXmlFullToAlphabetical() throws Exception {
}
@Test
- void testSortXmlMultilineComment() throws Exception {
+ void testSortXmlMultilineComment() {
XmlProcessorTestUtil.create()
.testInputAndExpected(
"src/test/resources/MultilineComment_input.xml",
@@ -53,7 +53,7 @@ void testSortXmlMultilineComment() throws Exception {
}
@Test
- void testSortXmlSimple() throws Exception {
+ void testSortXmlSimple() {
XmlProcessorTestUtil.create()
.testInputAndExpected(
"src/test/resources/Simple_input.xml", "src/test/resources/Simple_expected.xml");
diff --git a/sorter/src/test/java/sortpom/util/SortPomImplUtil.java b/sorter/src/test/java/sortpom/util/SortPomImplUtil.java
index bf26e80f..e026e4cb 100644
--- a/sorter/src/test/java/sortpom/util/SortPomImplUtil.java
+++ b/sorter/src/test/java/sortpom/util/SortPomImplUtil.java
@@ -48,8 +48,7 @@ public static SortPomImplUtil create() {
return new SortPomImplUtil();
}
- public void testFiles(String inputResourceFileName, String expectedResourceFileName)
- throws Exception {
+ public void testFiles(String inputResourceFileName, String expectedResourceFileName) {
setup();
testHandler =
new TestHandler(inputResourceFileName, expectedResourceFileName, getPluginParameters());
@@ -61,15 +60,15 @@ public void testFiles(String inputResourceFileName, String expectedResourceFileN
infoLogger.get(infoLogger.size() - 1), startsWith("[INFO] Saved sorted pom file to "));
}
- public void testFilesWithTimestamp(String inputResourceFileName, String expectedResourceFileName)
- throws Exception {
+ public void testFilesWithTimestamp(
+ String inputResourceFileName, String expectedResourceFileName) {
setup();
testHandler =
new TestHandler(inputResourceFileName, expectedResourceFileName, getPluginParameters());
testHandler.performSortThatTestsTimestamps();
}
- public void testNoSorting(String inputResourceFileName) throws Exception {
+ public void testNoSorting(String inputResourceFileName) {
setup();
testHandler =
new TestHandler(inputResourceFileName, inputResourceFileName, getPluginParameters());
@@ -77,15 +76,14 @@ public void testNoSorting(String inputResourceFileName) throws Exception {
assertEquals("[INFO] Pom file is already sorted, exiting", testHandler.getInfoLogger().get(1));
}
- public void testVerifyXmlIsOrdered(String inputResourceFileName) throws Exception {
+ public void testVerifyXmlIsOrdered(String inputResourceFileName) {
setup();
testHandler = new TestHandler(inputResourceFileName, getPluginParameters());
var xmlOrderedResult = testHandler.performVerify();
assertTrue(xmlOrderedResult.isOrdered(), "Expected that xml is ordered, ");
}
- public void testVerifyXmlIsNotOrdered(String inputResourceFileName, CharSequence warningMessage)
- throws Exception {
+ public void testVerifyXmlIsNotOrdered(String inputResourceFileName, CharSequence warningMessage) {
setup();
testHandler = new TestHandler(inputResourceFileName, getPluginParameters());
var xmlOrderedResult = testHandler.performVerify();
@@ -97,8 +95,7 @@ public void testVerifySort(
String inputResourceFileName,
String expectedResourceFileName,
String warningMessage,
- boolean outputToViolationFile)
- throws Exception {
+ boolean outputToViolationFile) {
setup();
testHandler =
new TestHandler(inputResourceFileName, expectedResourceFileName, getPluginParameters());
@@ -131,8 +128,7 @@ public void testVerifyFail(
}
public void testVerifyWarn(
- String inputResourceFileName, String warningMessage, boolean outputToViolationFile)
- throws Exception {
+ String inputResourceFileName, String warningMessage, boolean outputToViolationFile) {
setup();
testHandler =
new TestHandler(inputResourceFileName, inputResourceFileName, getPluginParameters());
diff --git a/sorter/src/test/java/sortpom/util/TestHandler.java b/sorter/src/test/java/sortpom/util/TestHandler.java
index 198603a5..cf8bfcad 100644
--- a/sorter/src/test/java/sortpom/util/TestHandler.java
+++ b/sorter/src/test/java/sortpom/util/TestHandler.java
@@ -9,6 +9,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -55,10 +56,14 @@ List getInfoLogger() {
return infoLogger;
}
- void performSortThatSorted() throws Exception {
+ void performSortThatSorted() {
removeOldTemporaryFiles();
- Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ try {
+ Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
performSorting();
assertTrue(testpom.exists());
@@ -77,15 +82,21 @@ void performSortThatSorted() throws Exception {
var expectedSorted = new String(expectedSortedPomInputStream.readAllBytes(), encoding);
assertEquals(expectedSorted, actualSorted);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
}
- void performVerifyThatSorted() throws Exception {
+ void performVerifyThatSorted() {
removeOldTemporaryFiles();
- Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ try {
+ Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
performVerifyWithSort();
assertTrue(testpom.exists());
@@ -98,6 +109,8 @@ void performVerifyThatSorted() throws Exception {
var expectedBackup = new String(originalPomInputStream.readAllBytes(), encoding);
assertEquals(expectedBackup, actualBackup);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
@@ -107,15 +120,21 @@ void performVerifyThatSorted() throws Exception {
var expectedSorted = new String(expectedSortedPomInputStream.readAllBytes(), encoding);
assertEquals(expectedSorted, actualSorted);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
}
- void performSortThatDidNotSort() throws Exception {
+ void performSortThatDidNotSort() {
removeOldTemporaryFiles();
- Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ try {
+ Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
performSorting();
assertTrue(testpom.exists());
@@ -127,6 +146,8 @@ void performSortThatDidNotSort() throws Exception {
var expectedSorted = new String(expectedSortedPomInputStream.readAllBytes(), encoding);
assertEquals(expectedSorted, actualSorted);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
@@ -137,7 +158,7 @@ private void performSorting() {
sortPomImpl.sortPom();
}
- XmlOrderedResult performVerify() throws Exception {
+ XmlOrderedResult performVerify() {
try {
removeOldTemporaryFiles();
Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
@@ -145,15 +166,21 @@ XmlOrderedResult performVerify() throws Exception {
assertTrue(testpom.exists());
return verifyOk;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
}
- void performVerifyThatDidNotSort() throws Exception {
+ void performVerifyThatDidNotSort() {
removeOldTemporaryFiles();
- Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ try {
+ Files.copy(Paths.get(inputResourceFileName), testpom.toPath());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
performVerifyWithSort();
assertTrue(testpom.exists());
@@ -165,12 +192,14 @@ void performVerifyThatDidNotSort() throws Exception {
var expectedSorted = new String(expectedSortedPomInputStream.readAllBytes(), encoding);
assertEquals(expectedSorted, actualSorted);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
}
- void performSortThatTestsTimestamps() throws Exception {
+ void performSortThatTestsTimestamps() {
try {
removeOldTemporaryFiles();
@@ -185,6 +214,8 @@ void performSortThatTestsTimestamps() throws Exception {
assertThat(testpom.lastModified(), greaterThan(pomTimestamp));
// Do not assert anything about the backup file, since that timestamp is OS dependent
}
+ } catch (IOException e) {
+ throw new RuntimeException(e);
} finally {
cleanupAfterTest();
}
diff --git a/sorter/src/test/java/sortpom/util/XmlProcessorTestUtil.java b/sorter/src/test/java/sortpom/util/XmlProcessorTestUtil.java
index f8246757..9f640799 100644
--- a/sorter/src/test/java/sortpom/util/XmlProcessorTestUtil.java
+++ b/sorter/src/test/java/sortpom/util/XmlProcessorTestUtil.java
@@ -6,9 +6,12 @@
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.Node;
+import org.xml.sax.SAXException;
import refutils.ReflectionHelper;
import sortpom.XmlProcessor;
import sortpom.output.XmlOutputGenerator;
@@ -44,29 +47,30 @@ public static XmlProcessorTestUtil create() {
private XmlProcessorTestUtil() {}
- public void testInputAndExpected(String inputFileName, String expectedFileName) throws Exception {
- var actual = sortXmlAndReturnResult(inputFileName);
-
+ public void testInputAndExpected(String inputFileName, String expectedFileName) {
try (var fileInputStream = new FileInputStream(expectedFileName)) {
+ var actual = sortXmlAndReturnResult(inputFileName);
var expected = new String(fileInputStream.readAllBytes(), StandardCharsets.UTF_8);
assertEquals(expected, actual);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
}
- public String sortXmlAndReturnResult(String inputFileName) throws Exception {
+ public String sortXmlAndReturnResult(String inputFileName) {
setup(inputFileName);
xmlProcessor.sortXml();
return xmlOutputGenerator.getSortedXml(xmlProcessor.getNewDocument());
}
- public void testVerifyXmlIsOrdered(String inputFileName) throws Exception {
+ public void testVerifyXmlIsOrdered(String inputFileName) {
setup(inputFileName);
xmlProcessor.sortXml();
assertTrue(xmlProcessor.isXmlOrdered().isOrdered());
}
- public void testVerifyXmlIsNotOrdered(String inputFileName, String infoMessage) throws Exception {
+ public void testVerifyXmlIsNotOrdered(String inputFileName, String infoMessage) {
setup(inputFileName);
xmlProcessor.sortXml();
var xmlOrdered = xmlProcessor.isXmlOrdered();
@@ -74,7 +78,7 @@ public void testVerifyXmlIsNotOrdered(String inputFileName, String infoMessage)
assertEquals(infoMessage, xmlOrdered.getErrorMessage());
}
- private void setup(String inputFileName) throws Exception {
+ private void setup(String inputFileName) {
var pluginParameters =
PluginParameters.builder()
.setPomFile(null)
@@ -95,6 +99,8 @@ private void setup(String inputFileName) throws Exception {
String xml;
try (var fileInputStream = new FileInputStream(inputFileName)) {
xml = new String(fileInputStream.readAllBytes(), StandardCharsets.UTF_8);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
}
var fileUtil = new FileUtil();
@@ -131,7 +137,11 @@ public Wrapper create(T content) {
new ReflectionHelper(wrapperFactory).setField(fileUtil);
}
new ReflectionHelper(xmlProcessor).setField(wrapperFactory);
- xmlProcessor.setOriginalXml(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
+ try {
+ xmlProcessor.setOriginalXml(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
+ } catch (DocumentException | SAXException e) {
+ throw new RuntimeException(e);
+ }
}
public XmlProcessorTestUtil sortAlphabeticalOnly() {
diff --git a/sorter/src/test/java/sortpom/verify/ExpandEmptyElementTest.java b/sorter/src/test/java/sortpom/verify/ExpandEmptyElementTest.java
index c3090a55..3ff79fd4 100644
--- a/sorter/src/test/java/sortpom/verify/ExpandEmptyElementTest.java
+++ b/sorter/src/test/java/sortpom/verify/ExpandEmptyElementTest.java
@@ -5,28 +5,28 @@
class ExpandEmptyElementTest {
@Test
- void trueExpandedParameterAndTrueExpandedElementShouldNotAffectVerify() throws Exception {
+ void trueExpandedParameterAndTrueExpandedElementShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.expandEmptyElements(true)
.testVerifyXmlIsOrdered("src/test/resources/ExpandedElement_input.xml");
}
@Test
- void falseExpandedParameterAndTrueExpandedElementShouldNotAffectVerify() throws Exception {
+ void falseExpandedParameterAndTrueExpandedElementShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.expandEmptyElements(false)
.testVerifyXmlIsOrdered("src/test/resources/ExpandedElement_input.xml");
}
@Test
- void trueExpandedParameterAndFalseExpandedElementShouldNotAffectVerify() throws Exception {
+ void trueExpandedParameterAndFalseExpandedElementShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.expandEmptyElements(true)
.testVerifyXmlIsOrdered("src/test/resources/ExpandedElementNot_input.xml");
}
@Test
- void falseExpandedParameterAndFalseExpandedElementShouldNotAffectVerify() throws Exception {
+ void falseExpandedParameterAndFalseExpandedElementShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.expandEmptyElements(true)
.testVerifyXmlIsOrdered("src/test/resources/ExpandedElementNot_input.xml");
diff --git a/sorter/src/test/java/sortpom/verify/KeepBlankLinesTest.java b/sorter/src/test/java/sortpom/verify/KeepBlankLinesTest.java
index 812729c8..1eff87d0 100644
--- a/sorter/src/test/java/sortpom/verify/KeepBlankLinesTest.java
+++ b/sorter/src/test/java/sortpom/verify/KeepBlankLinesTest.java
@@ -6,21 +6,21 @@
class KeepBlankLinesTest {
@Test
- void emptyLinesInXmlShouldNotAffectVerify() throws Exception {
+ void emptyLinesInXmlShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("src/test/resources/EmptyRow_input2.xml");
}
@Test
- void emptyLinesInXmlShouldNotAffectVerify2() throws Exception {
+ void emptyLinesInXmlShouldNotAffectVerify2() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("src/test/resources/EmptyRow_input2.xml");
}
@Test
- void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify() throws Exception {
+ void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.indentBlankLines()
@@ -28,14 +28,14 @@ void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify() throws Exception {
}
@Test
- void emptyLinesInXmlShouldNotAffectVerify3() throws Exception {
+ void emptyLinesInXmlShouldNotAffectVerify3() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("/EmptyRow_input2.xml");
}
@Test
- void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify2() throws Exception {
+ void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify2() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.indentBLankLines()
@@ -43,7 +43,7 @@ void emptyLinesInXmlAndIndentParameterShouldNotAffectVerify2() throws Exception
}
@Test
- void unsortedXmlAndIndentParameterShouldAffectVerify() throws Exception {
+ void unsortedXmlAndIndentParameterShouldAffectVerify() {
SortPomImplUtil.create()
.indentBLankLines()
.testVerifyXmlIsNotOrdered(
@@ -52,14 +52,14 @@ void unsortedXmlAndIndentParameterShouldAffectVerify() throws Exception {
}
@Test
- void simpleLineBreaksShouldNotAffectVerify() throws Exception {
+ void simpleLineBreaksShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("src/test/resources/LineBreak_input2.xml");
}
@Test
- void unsortedXmlShouldAffectVerify() throws Exception {
+ void unsortedXmlShouldAffectVerify() {
XmlProcessorTestUtil.create()
.testVerifyXmlIsNotOrdered(
"src/test/resources/LineBreak_input.xml",
diff --git a/sorter/src/test/java/sortpom/verify/SortOrderFilesTest.java b/sorter/src/test/java/sortpom/verify/SortOrderFilesTest.java
index 5e16d07e..dc117c63 100644
--- a/sorter/src/test/java/sortpom/verify/SortOrderFilesTest.java
+++ b/sorter/src/test/java/sortpom/verify/SortOrderFilesTest.java
@@ -4,14 +4,13 @@
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import java.lang.reflect.InvocationTargetException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import sortpom.util.SortPomImplUtil;
class SortOrderFilesTest {
@Test
- void sortedCustomSortOrderShouldNotTriggerVerify() throws Exception {
+ void sortedCustomSortOrderShouldNotTriggerVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.lineSeparator("\n")
@@ -19,7 +18,7 @@ void sortedCustomSortOrderShouldNotTriggerVerify() throws Exception {
}
@Test
- void unsortedCustomSortOrderShouldTriggerVerify() throws Exception {
+ void unsortedCustomSortOrderShouldTriggerVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.lineSeparator("\n")
@@ -29,7 +28,7 @@ void unsortedCustomSortOrderShouldTriggerVerify() throws Exception {
}
@Test
- void default040ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void default040ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.lineSeparator("\n")
@@ -37,7 +36,7 @@ void default040ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void custom1ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void custom1ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("custom_1")
.lineSeparator("\n")
@@ -45,7 +44,7 @@ void custom1ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void recommended2008_06ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void recommended2008_06ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("recommended_2008_06")
.lineSeparator("\n")
@@ -53,7 +52,7 @@ void recommended2008_06ShouldWorkAsPredefinedSortOrder() throws Exception {
}
@Test
- void default100ShouldWorkAsPredefinedSortOrder() throws Exception {
+ void default100ShouldWorkAsPredefinedSortOrder() {
SortPomImplUtil.create()
.predefinedSortOrder("default_1_0_0")
.lineSeparator("\n")
@@ -69,15 +68,15 @@ void illegalPredefinedSortOrderShouldReportError() {
.lineSeparator("\n")
.testVerifyXmlIsOrdered("/sortOrderFiles/sorted_default_1_0_0.xml");
- var thrown = assertThrows(InvocationTargetException.class, testMethod);
+ var thrown = assertThrows(RuntimeException.class, testMethod).getCause().getCause();
assertThat(
- thrown.getCause().getMessage(),
+ thrown.getMessage(),
is("Cannot find special.xml.xml among the predefined plugin resources"));
}
@Test
- void xmlDeviationsShouldNotHarmPlugin() throws Exception {
+ void xmlDeviationsShouldNotHarmPlugin() {
SortPomImplUtil.create()
.lineSeparator("\n")
.testVerifyXmlIsOrdered("/Xml_deviations_output.xml");
diff --git a/sorter/src/test/java/sortpom/verify/SortOrderTest.java b/sorter/src/test/java/sortpom/verify/SortOrderTest.java
index bb0051a2..fc7c1d8b 100644
--- a/sorter/src/test/java/sortpom/verify/SortOrderTest.java
+++ b/sorter/src/test/java/sortpom/verify/SortOrderTest.java
@@ -6,50 +6,50 @@
class SortOrderTest {
@Test
- void testSortDifferentClassPathShouldNotAffectVerify() throws Exception {
+ void testSortDifferentClassPathShouldNotAffectVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.testVerifyXmlIsOrdered("/full_differentorder_expected.xml");
}
@Test
- void testSortXmlCharacterShouldNotAffectVerify() throws Exception {
+ void testSortXmlCharacterShouldNotAffectVerify() {
SortPomImplUtil.create().testVerifyXmlIsOrdered("/Character_expected.xml");
}
@Test
- void testSortXmlComplexShouldNotAffectVerify() throws Exception {
+ void testSortXmlComplexShouldNotAffectVerify() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("/Complex_expected.xml");
}
@Test
- void testSortXmlFullFromAlphabeticalOrderShouldNotAffectVerify() throws Exception {
+ void testSortXmlFullFromAlphabeticalOrderShouldNotAffectVerify() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("/full_expected.xml");
}
@Test
- void testSortXmlReal1ShouldNotAffectVerify() throws Exception {
+ void testSortXmlReal1ShouldNotAffectVerify() {
SortPomImplUtil.create().testVerifyXmlIsOrdered("/Real1_expected.xml");
}
@Test
- void testSortXmlSimpleShouldNotAffectVerify() throws Exception {
+ void testSortXmlSimpleShouldNotAffectVerify() {
SortPomImplUtil.create().testVerifyXmlIsOrdered("/Simple_expected.xml");
}
@Test
- void testSortWithIndentShouldNotAffectVerify() throws Exception {
+ void testSortWithIndentShouldNotAffectVerify() {
SortPomImplUtil.create()
.nrOfIndentSpace(42)
.testVerifyXmlIsOrdered("/Simple_expected_indent.xml");
}
@Test
- void testSortWithDependencySortSimpleShouldNotAffectVerify() throws Exception {
+ void testSortWithDependencySortSimpleShouldNotAffectVerify() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.sortPlugins("groupId,artifactId")
@@ -57,7 +57,7 @@ void testSortWithDependencySortSimpleShouldNotAffectVerify() throws Exception {
}
@Test
- void testSortWithDependencySortFullShouldNotAffectVerify() throws Exception {
+ void testSortWithDependencySortFullShouldNotAffectVerify() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.sortPlugins("groupId,artifactId")
@@ -65,7 +65,7 @@ void testSortWithDependencySortFullShouldNotAffectVerify() throws Exception {
}
@Test
- void testSortDifferentClassPathShouldAffectVerify() throws Exception {
+ void testSortDifferentClassPathShouldAffectVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/differentOrder.xml")
.testVerifyXmlIsNotOrdered(
@@ -74,7 +74,7 @@ void testSortDifferentClassPathShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlCharacterShouldAffectVerify() throws Exception {
+ void testSortXmlCharacterShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/Character_input.xml",
@@ -82,7 +82,7 @@ void testSortXmlCharacterShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlComplexShouldAffectVerify() throws Exception {
+ void testSortXmlComplexShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/Complex_input.xml",
@@ -90,7 +90,7 @@ void testSortXmlComplexShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlFullFromAlphabeticalOrderShouldAffectVerify() throws Exception {
+ void testSortXmlFullFromAlphabeticalOrderShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/full_alfa_input.xml",
@@ -98,7 +98,7 @@ void testSortXmlFullFromAlphabeticalOrderShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlFullShouldAffectVerify() throws Exception {
+ void testSortXmlFullShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/full_unsorted_input.xml",
@@ -106,14 +106,14 @@ void testSortXmlFullShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlReal1ShouldAffectVerify() throws Exception {
+ void testSortXmlReal1ShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/Real1_input.xml", "The xml element should be placed before ");
}
@Test
- void testSortXmlSimpleShouldAffectVerify() throws Exception {
+ void testSortXmlSimpleShouldAffectVerify() {
SortPomImplUtil.create()
.testVerifyXmlIsNotOrdered(
"/Simple_input.xml",
@@ -121,7 +121,7 @@ void testSortXmlSimpleShouldAffectVerify() throws Exception {
}
@Test
- void sortedDependenciesWithDifferentChildrenShouldAffectVerify() throws Exception {
+ void sortedDependenciesWithDifferentChildrenShouldAffectVerify() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.testVerifyXmlIsNotOrdered(
@@ -130,7 +130,7 @@ void sortedDependenciesWithDifferentChildrenShouldAffectVerify() throws Exceptio
}
@Test
- void sortedDependenciesWithDifferentNamesShouldAffectVerify() throws Exception {
+ void sortedDependenciesWithDifferentNamesShouldAffectVerify() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.testVerifyXmlIsNotOrdered(
@@ -139,7 +139,7 @@ void sortedDependenciesWithDifferentNamesShouldAffectVerify() throws Exception {
}
@Test
- void sortedDependenciesWithSameNameShouldAffectVerify() throws Exception {
+ void sortedDependenciesWithSameNameShouldAffectVerify() {
SortPomImplUtil.create()
.sortDependencies("groupId,artifactId")
.testVerifyXmlIsNotOrdered(
@@ -148,7 +148,7 @@ void sortedDependenciesWithSameNameShouldAffectVerify() throws Exception {
}
@Test
- void testSortWithDependencySortFullShouldAffectVerify() throws Exception {
+ void testSortWithDependencySortFullShouldAffectVerify() {
SortPomImplUtil.create()
.predefinedSortOrder("default_0_4_0")
.sortDependencies("groupId,artifactId")
diff --git a/sorter/src/test/java/sortpom/verify/SortPropertiesTest.java b/sorter/src/test/java/sortpom/verify/SortPropertiesTest.java
index c7259783..ad47dc74 100644
--- a/sorter/src/test/java/sortpom/verify/SortPropertiesTest.java
+++ b/sorter/src/test/java/sortpom/verify/SortPropertiesTest.java
@@ -6,7 +6,7 @@
class SortPropertiesTest {
@Test
- void namedParametersInSortFileShouldNotAffectVerify() throws Exception {
+ void namedParametersInSortFileShouldNotAffectVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
.lineSeparator("\n")
@@ -14,7 +14,7 @@ void namedParametersInSortFileShouldNotAffectVerify() throws Exception {
}
@Test
- void sortPropertyParameterShouldNotAffectVerify() throws Exception {
+ void sortPropertyParameterShouldNotAffectVerify() {
SortPomImplUtil.create()
.sortProperties()
.lineSeparator("\n")
@@ -23,8 +23,7 @@ void sortPropertyParameterShouldNotAffectVerify() throws Exception {
}
@Test
- void testBothNamedParametersInSortFileAndSortPropertyParameterTestNotAffectVerify()
- throws Exception {
+ void testBothNamedParametersInSortFileAndSortPropertyParameterTestNotAffectVerify() {
SortPomImplUtil.create()
.lineSeparator("\n")
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
@@ -33,7 +32,7 @@ void testBothNamedParametersInSortFileAndSortPropertyParameterTestNotAffectVerif
}
@Test
- void sortingOfFullPomFileShouldNotAffectVerify() throws Exception {
+ void sortingOfFullPomFileShouldNotAffectVerify() {
SortPomImplUtil.create()
.sortProperties()
.sortPlugins("groupId,artifactId")
@@ -43,7 +42,7 @@ void sortingOfFullPomFileShouldNotAffectVerify() throws Exception {
}
@Test
- void namedParametersInSortFileShouldAffectVerify() throws Exception {
+ void namedParametersInSortFileShouldAffectVerify() {
SortPomImplUtil.create()
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
.lineSeparator("\n")
@@ -53,7 +52,7 @@ void namedParametersInSortFileShouldAffectVerify() throws Exception {
}
@Test
- void sortPropertyParameterShouldAffectVerify() throws Exception {
+ void sortPropertyParameterShouldAffectVerify() {
SortPomImplUtil.create()
.sortProperties()
.lineSeparator("\n")
@@ -64,8 +63,7 @@ void sortPropertyParameterShouldAffectVerify() throws Exception {
}
@Test
- void testBothNamedParametersInSortFileAndSortPropertyParameterTestAffectVerify()
- throws Exception {
+ void testBothNamedParametersInSortFileAndSortPropertyParameterTestAffectVerify() {
SortPomImplUtil.create()
.lineSeparator("\n")
.customSortOrderFile("difforder/sortedPropertiesOrder.xml")
@@ -76,7 +74,7 @@ void testBothNamedParametersInSortFileAndSortPropertyParameterTestAffectVerify()
}
@Test
- void sortingOfFullPomFileShouldAffectVerify() throws Exception {
+ void sortingOfFullPomFileShouldAffectVerify() {
SortPomImplUtil.create()
.sortProperties()
.predefinedSortOrder("default_0_4_0")
diff --git a/sorter/src/test/java/sortpom/verify/VerifyOrderTest.java b/sorter/src/test/java/sortpom/verify/VerifyOrderTest.java
index 74ab5aac..0c03fa6d 100644
--- a/sorter/src/test/java/sortpom/verify/VerifyOrderTest.java
+++ b/sorter/src/test/java/sortpom/verify/VerifyOrderTest.java
@@ -11,14 +11,14 @@
class VerifyOrderTest {
@Test
- void sortedButUnformattedSortOrderShouldPass() throws Exception {
+ void sortedButUnFormattedSortOrderShouldPass() {
SortPomImplUtil.create()
.predefinedSortOrder("recommended_2008_06")
.testVerifyXmlIsOrdered("/Real2_input.xml");
}
@Test
- void wrongSortedShouldNotPass() throws Exception {
+ void wrongSortedShouldNotPass() {
SortPomImplUtil.create()
.predefinedSortOrder("custom_1")
.testVerifyXmlIsNotOrdered(
@@ -27,7 +27,7 @@ void wrongSortedShouldNotPass() throws Exception {
}
@Test
- void wrongSortedWithStrictVerifyShouldNotPass() throws Exception {
+ void wrongSortedWithStrictVerifyShouldNotPass() {
SortPomImplUtil.create()
.verifyFailOn("strict")
.predefinedSortOrder("custom_1")
@@ -37,7 +37,7 @@ void wrongSortedWithStrictVerifyShouldNotPass() throws Exception {
}
@Test
- void unsortedDefaultVerifyShouldPerformSort() throws Exception {
+ void unsortedDefaultVerifyShouldPerformSort() {
SortPomImplUtil.create()
.noKeepBlankLines()
.testVerifySort(
@@ -48,7 +48,7 @@ void unsortedDefaultVerifyShouldPerformSort() throws Exception {
}
@Test
- void unsortedDefaultStrictVerifyShouldPerformSort() throws Exception {
+ void unsortedDefaultStrictVerifyShouldPerformSort() {
SortPomImplUtil.create()
.verifyFailOn("STRICT")
.noKeepBlankLines()
@@ -61,7 +61,7 @@ void unsortedDefaultStrictVerifyShouldPerformSort() throws Exception {
}
@Test
- void unsortedSortVerifyShouldPerformSort() throws Exception {
+ void unsortedSortVerifyShouldPerformSort() {
SortPomImplUtil.create()
.noKeepBlankLines()
.verifyFail("SORT")
@@ -84,7 +84,7 @@ void unsortedStopVerifyShouldPerformSort() {
}
@Test
- void unsortedWarnVerifyShouldPerformSort() throws Exception {
+ void unsortedWarnVerifyShouldPerformSort() {
SortPomImplUtil.create()
.verifyFail("WARN")
.testVerifyWarn(
diff --git a/sorter/src/test/java/sortpom/verify/XmlProcessorTest.java b/sorter/src/test/java/sortpom/verify/XmlProcessorTest.java
index d508241a..45933f07 100644
--- a/sorter/src/test/java/sortpom/verify/XmlProcessorTest.java
+++ b/sorter/src/test/java/sortpom/verify/XmlProcessorTest.java
@@ -6,20 +6,20 @@
class XmlProcessorTest {
@Test
- void testSortXmlAttributesShouldNotAffectVerify() throws Exception {
+ void testSortXmlAttributesShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.predefinedSortOrder("default_0_4_0")
.testVerifyXmlIsOrdered("src/test/resources/Attribute_expected.xml");
}
@Test
- void testSortXmlMultilineCommentShouldNotAffectVerify() throws Exception {
+ void testSortXmlMultilineCommentShouldNotAffectVerify() {
XmlProcessorTestUtil.create()
.testVerifyXmlIsOrdered("src/test/resources/MultilineComment_expected.xml");
}
@Test
- void testSortXmlAttributesShouldAffectVerify() throws Exception {
+ void testSortXmlAttributesShouldAffectVerify() {
XmlProcessorTestUtil.create()
.testVerifyXmlIsNotOrdered(
"src/test/resources/Attribute_input.xml",
@@ -27,7 +27,7 @@ void testSortXmlAttributesShouldAffectVerify() throws Exception {
}
@Test
- void testSortXmlMultilineCommentShouldAffectVerify() throws Exception {
+ void testSortXmlMultilineCommentShouldAffectVerify() {
XmlProcessorTestUtil.create()
.testVerifyXmlIsNotOrdered(
"src/test/resources/MultilineComment_input.xml",
diff --git a/sorter/src/test/resources/PreserveContent_input.xml b/sorter/src/test/resources/PreserveContent_input.xml
new file mode 100644
index 00000000..e7b4c42e
--- /dev/null
+++ b/sorter/src/test/resources/PreserveContent_input.xml
@@ -0,0 +1,29 @@
+
+
+ 4.0
+ preserve
+
+
+
+ plugin
+
+ true
+
+
+ ${generated-ts-client-file}
+
+ THIS
+ IS A
+ MESSAGE!
+
+ asEnum
+
+ true
+
+
+
+
+
+
+
+
diff --git a/sorter/src/test/resources/PreserveContent_output.xml b/sorter/src/test/resources/PreserveContent_output.xml
new file mode 100644
index 00000000..da7c86b8
--- /dev/null
+++ b/sorter/src/test/resources/PreserveContent_output.xml
@@ -0,0 +1,29 @@
+
+
+ 4.0
+ preserve
+
+
+
+ plugin
+
+ true
+
+
+ ${generated-ts-client-file}
+
+ THIS
+ IS A
+ MESSAGE!
+
+ asEnum
+
+ true
+
+
+
+
+
+
+
+