This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-shared-utils.git
commit f966392e25a8a1177d3252a5cc4c1195d4d03d95 Author: Sylwester Lachiewicz <slachiew...@apache.org> AuthorDate: Fri May 2 21:08:09 2025 +0200 Fix checkstyle issues --- .../org/apache/maven/shared/utils/CaseTest.java | 4 + .../java/org/apache/maven/shared/utils/OsTest.java | 2 +- .../apache/maven/shared/utils/PathToolTest.java | 10 +- .../maven/shared/utils/PropertyUtilsTest.java | 2 +- .../apache/maven/shared/utils/StringUtilsTest.java | 170 ++++++++++----------- .../maven/shared/utils/XmlStreamReaderTest.java | 2 +- .../shared/utils/cli/CommandLineUtilsTest.java | 18 +-- .../shared/utils/cli/StreamPollFeederTest.java | 10 +- .../shared/utils/cli/shell/BourneShellTest.java | 4 +- .../maven/shared/utils/io/FileUtilsTest.java | 25 +-- .../apache/maven/shared/utils/io/IOUtilTest.java | 40 ++--- .../maven/shared/utils/io/MatchPatternTest.java | 2 +- .../maven/shared/utils/io/MatchPatternsTest.java | 3 +- .../maven/shared/utils/io/SelectorUtilsTest.java | 3 +- .../utils/logging/AnsiMessageBuilderTest.java | 18 +-- .../maven/shared/utils/xml/XmlWriterUtilTest.java | 10 +- .../maven/shared/utils/xml/pull/Xpp3DomTest.java | 5 +- 17 files changed, 168 insertions(+), 160 deletions(-) diff --git a/src/test/java/org/apache/maven/shared/utils/CaseTest.java b/src/test/java/org/apache/maven/shared/utils/CaseTest.java index 9b2e5c0..04f0823 100644 --- a/src/test/java/org/apache/maven/shared/utils/CaseTest.java +++ b/src/test/java/org/apache/maven/shared/utils/CaseTest.java @@ -37,12 +37,15 @@ public class CaseTest extends Assert { private static final Locale LOCALE_TURKISH = new Locale("tr"); /** common ASCII 'i' */ + @SuppressWarnings("ConstantName") private static final char DOTTED_i = '\u0069'; /** common ASCII 'I' */ + @SuppressWarnings("ConstantName") private static final char DOTLESS_I = '\u0049'; /** turkish dotless i = ı */ + @SuppressWarnings("ConstantName") private static final char DOTLESS_i = '\u0131'; /** turkish dotted I = İ */ @@ -68,6 +71,7 @@ public class CaseTest extends Assert { assertEquals("common lowercase i should have a dot", 'i', DOTTED_i); assertEquals("common uppercase I should not have a dot", 'I', DOTLESS_I); + @SuppressWarnings("LocalFinalVariableName") final String iIıİ = "iIıİ"; // check source encoding doesn't wreak havoc */ diff --git a/src/test/java/org/apache/maven/shared/utils/OsTest.java b/src/test/java/org/apache/maven/shared/utils/OsTest.java index e5a321a..08e6c39 100644 --- a/src/test/java/org/apache/maven/shared/utils/OsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/OsTest.java @@ -25,7 +25,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; /** diff --git a/src/test/java/org/apache/maven/shared/utils/PathToolTest.java b/src/test/java/org/apache/maven/shared/utils/PathToolTest.java index 3aa0da3..c46a5cd 100644 --- a/src/test/java/org/apache/maven/shared/utils/PathToolTest.java +++ b/src/test/java/org/apache/maven/shared/utils/PathToolTest.java @@ -40,8 +40,8 @@ public class PathToolTest { public TemporaryFolder tempFolder = new TemporaryFolder(); @Test - // Keep in sync with testGetRelativeFilePath_Windows() - public void testGetRelativeFilePath_NonWindows() { + // Keep in sync with testGetRelativeFilePathWindows() + public void testGetRelativeFilePathNonWindows() { Assume.assumeThat(File.separatorChar, is('/')); assertThat(PathTool.getRelativeFilePath(null, null), is("")); @@ -66,8 +66,8 @@ public class PathToolTest { } @Test - // Keep in sync with testGetRelativeFilePath_NonWindows() - public void testGetRelativeFilePath_Windows() { + // Keep in sync with testGetRelativeFilePathNonWindows() + public void testGetRelativeFilePathWindows() { Assume.assumeThat(File.separatorChar, is('\\')); assertThat(PathTool.getRelativeFilePath(null, null), is("")); @@ -96,7 +96,7 @@ public class PathToolTest { } @Test - public void testGetRelativePath_2parm() { + public void testGetRelativePath2Parm() { assertThat(PathTool.getRelativePath(null, null), is("")); assertThat(PathTool.getRelativePath(null, "/usr/local/java/bin"), is("")); diff --git a/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java index 24940a9..5ea2f47 100644 --- a/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/PropertyUtilsTest.java @@ -62,7 +62,7 @@ public class PropertyUtilsTest { } @Test - public void loadOptionalProperties_ioException() throws Exception { + public void loadOptionalPropertiesIoException() throws Exception { URL url = new URL("https://nonesuch12344.foo.bar.com"); assertThat(PropertyUtils.loadOptionalProperties(url), is(new Properties())); } diff --git a/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java index 670403c..1d1abb4 100644 --- a/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/StringUtilsTest.java @@ -37,12 +37,12 @@ import static org.hamcrest.MatcherAssert.assertThat; public class StringUtilsTest { @Test(expected = NullPointerException.class) - public void testAbbreviate_NPE() { + public void testAbbreviateNPE() { assertThat(StringUtils.abbreviate(null, 10), nullValue()); } @Test(expected = IllegalArgumentException.class) - public void testAbbreviate_MinLength() { + public void testAbbreviateMinLength() { assertThat(StringUtils.abbreviate("This is a longtext", 3), is("T")); } @@ -54,17 +54,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testAbbreviate_Offset_NPE() { + public void testAbbreviateOffsetNPE() { assertThat(StringUtils.abbreviate(null, 10, 20), nullValue()); } @Test(expected = IllegalArgumentException.class) - public void testAbbreviate_Offset_MinLength() { + public void testAbbreviateOffsetMinLength() { assertThat(StringUtils.abbreviate("This is a longtext", 10, 3), is("T")); } @Test - public void testAbbreviate_Offset() { + public void testAbbreviateOffset() { assertThat(StringUtils.abbreviate("This is a longtext", 5, 10), is("...is a...")); assertThat(StringUtils.abbreviate("This is a longtext", 10, 20), is("This is a longtext")); @@ -73,7 +73,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testAddAndDeHump_NPE() { + public void testAddAndDeHumpNPE() { StringUtils.addAndDeHump(null); } @@ -101,7 +101,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testCapitalizeFirstLetter_NPE() { + public void testCapitalizeFirstLetterNPE() { assertThat(StringUtils.capitalizeFirstLetter(null), nullValue()); } @@ -115,7 +115,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testCenter_NPE() { + public void testCenterNPE() { StringUtils.center(null, 20); } @@ -129,12 +129,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testCenter_Delim_NPE() { + public void testCenterDelimNPE() { StringUtils.center(null, 20, "*"); } @Test - public void testCenter_Delim() { + public void testCenterDelim() { assertThat(StringUtils.center("centerMe", 20, "*"), is("******centerMe******")); assertThat(StringUtils.center("centerMe", 4, "*"), is("centerMe")); @@ -143,7 +143,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChomp_NPE() { + public void testChompNPE() { StringUtils.chomp(null); } @@ -159,12 +159,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChomp_Delim_NPE() { + public void testChompDelimNPE() { StringUtils.chomp(null, "+"); } @Test - public void testChomp_Delim() { + public void testChompDelim() { assertThat(StringUtils.chomp("dings", "+"), is("dings")); assertThat(StringUtils.chomp("dings+", "+"), is("dings")); @@ -175,7 +175,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChompLast_NPE() { + public void testChompLastNPE() { StringUtils.chompLast(null); } @@ -193,12 +193,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChompLast_Delim_NPE() { + public void testChompLastDelimNPE() { StringUtils.chompLast(null, "+"); } @Test - public void testChompLast_Delim() { + public void testChompLastDelim() { assertThat(StringUtils.chompLast("dings", "+"), is("dings")); assertThat(StringUtils.chompLast("+", "+"), is("")); @@ -211,7 +211,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChop_NPE() { + public void testChopNPE() { StringUtils.chop(null); } @@ -229,7 +229,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testChopNewline_NPE() { + public void testChopNewlineNPE() { StringUtils.chopNewline(null); } @@ -258,7 +258,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testConcatenate_NPE() { + public void testConcatenateNPE() { StringUtils.concatenate(null); } @@ -272,7 +272,7 @@ public class StringUtilsTest { } @Test - public void testContains_String() { + public void testContainsString() { assertThat(StringUtils.contains(null, null), is(false)); assertThat(StringUtils.contains(null, "string"), is(false)); @@ -287,7 +287,7 @@ public class StringUtilsTest { } @Test - public void testContains_Char() { + public void testContainsChar() { assertThat(StringUtils.contains(null, 'c'), is(false)); assertThat(StringUtils.contains("string", "c"), is(false)); @@ -300,12 +300,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testCountMatches_NPE() { + public void testCountMatchesNPE() { StringUtils.countMatches(null, null); } @Test(expected = NullPointerException.class) - public void testCountMatches_NPE2() { + public void testCountMatchesNPE2() { StringUtils.countMatches("this is it", null); } @@ -326,14 +326,14 @@ public class StringUtilsTest { } @Test - public void testDefaultString_defaultValue() { + public void testDefaultStringDefaultValue() { assertThat(StringUtils.defaultString(null, "defaultValue"), is("defaultValue")); assertThat(StringUtils.defaultString("dings", "defaultValue"), is("dings")); } @Test(expected = NullPointerException.class) - public void testDeleteWhitespace_NPE() { + public void testDeleteWhitespaceNPE() { StringUtils.deleteWhitespace(null); } @@ -349,17 +349,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testDifference_NPE() { + public void testDifferenceNPE() { StringUtils.difference(null, null); } @Test(expected = NullPointerException.class) - public void testDifference_NPE2() { + public void testDifferenceNPE2() { StringUtils.difference(null, "another"); } @Test(expected = NullPointerException.class) - public void testDifference_NPE3() { + public void testDifferenceNPE3() { StringUtils.difference("this", null); } @@ -373,17 +373,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testDifferenceAt_NPE() { + public void testDifferenceAtNPE() { StringUtils.differenceAt(null, null); } @Test(expected = NullPointerException.class) - public void testDifferenceAt_NPE2() { + public void testDifferenceAtNPE2() { StringUtils.differenceAt("test", null); } @Test(expected = NullPointerException.class) - public void testDifferenceAt_NPE3() { + public void testDifferenceAtNPE3() { StringUtils.differenceAt(null, "test"); } @@ -440,7 +440,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testEscape_NPE() { + public void testEscapeNPE() { StringUtils.escape(null); } @@ -466,17 +466,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testGetChomp_NPE1() { + public void testGetChompNPE1() { StringUtils.getChomp(null, null); } @Test(expected = NullPointerException.class) - public void testGetChomp_NPE2() { + public void testGetChompNPE2() { StringUtils.getChomp("dings", null); } @Test(expected = NullPointerException.class) - public void testGetChomp_NPE3() { + public void testGetChompNPE3() { StringUtils.getChomp(null, "dings"); } @@ -490,7 +490,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testGetNestedString_NPE() { + public void testGetNestedStringNPE() { assertThat(StringUtils.getNestedString(" +dings+ ", null), nullValue()); } @@ -504,12 +504,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testGetNestedString2_NPE1() { + public void testGetNestedString2NPE1() { assertThat(StringUtils.getNestedString(" +dings+ ", null, null), nullValue()); } @Test(expected = NullPointerException.class) - public void testGetNestedString2_NPE2() { + public void testGetNestedString2NPE2() { assertThat(StringUtils.getNestedString(" +dings+ ", null, "neither"), nullValue()); } @@ -525,12 +525,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testGetPrechomp_NPE1() { + public void testGetPrechompNPE1() { StringUtils.getPrechomp(null, null); } @Test(expected = NullPointerException.class) - public void testGetPrechomp_NPE2() { + public void testGetPrechompNPE2() { StringUtils.getPrechomp(null, "bums"); } @@ -553,12 +553,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testInterpolate_NPE() { + public void testInterpolateNPE() { StringUtils.interpolate(null, null); } @Test(expected = NullPointerException.class) - public void testInterpolate_NPE2() { + public void testInterpolateNPE2() { StringUtils.interpolate("This ${text} will get replaced", null); } @@ -747,12 +747,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testJoin_Array_NPE() { + public void testJoinArrayNPE() { StringUtils.join((Object[]) null, null); } @Test - public void testJoin_Array() { + public void testJoinArray() { assertThat(StringUtils.join(new Object[0], null), is("")); assertThat(StringUtils.join(new Object[] {"a", "b", "c"}, null), is("abc")); @@ -761,12 +761,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testJoin_Iterator_NPE() { + public void testJoinIteratorNPE() { StringUtils.join((Iterator<?>) null, null); } @Test - public void testJoin_Iterator() { + public void testJoinIterator() { ArrayList<String> list = new ArrayList<>(); assertThat(StringUtils.join(list.iterator(), null), is("")); @@ -792,7 +792,7 @@ public class StringUtilsTest { } @Test(expected = IllegalArgumentException.class) - public void testLeft_IAE() { + public void testLeftIAE() { StringUtils.left(null, -1); } @@ -808,7 +808,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testLeftPad1_NPE() { + public void testLeftPad1NPE() { StringUtils.leftPad(null, 0); } @@ -822,17 +822,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testLeftPad2_NPE1() { + public void testLeftPad2NPE1() { StringUtils.leftPad(null, 0, null); } @Test(expected = NullPointerException.class) - public void testLeftPad2_NPE2() { + public void testLeftPad2NPE2() { StringUtils.leftPad("dings", 0, null); } @Test(expected = NullPointerException.class) - public void testLeftPad2_NPE3() { + public void testLeftPad2NPE3() { StringUtils.leftPad(null, 0, "*"); } @@ -855,7 +855,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testLowerCaseFirstLetter_NPE() { + public void testLowerCaseFirstLetterNPE() { StringUtils.lowercaseFirstLetter(null); } @@ -865,12 +865,12 @@ public class StringUtilsTest { } @Test(expected = IllegalArgumentException.class) - public void testMid_NegativeLen() { + public void testMidNegativeLen() { StringUtils.mid(null, 0, -2); } @Test(expected = IndexOutOfBoundsException.class) - public void testMid_WrongPos() { + public void testMidWrongPos() { StringUtils.mid(null, -2, 3); } @@ -884,17 +884,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testOverlayString_NPE1() { + public void testOverlayStringNPE1() { StringUtils.overlayString(null, null, 0, 0); } @Test(expected = NullPointerException.class) - public void testOverlayString_NPE2() { + public void testOverlayStringNPE2() { StringUtils.overlayString("dings", null, 0, 0); } @Test(expected = NullPointerException.class) - public void testOverlayString_NPE3() { + public void testOverlayStringNPE3() { StringUtils.overlayString(null, "bums", 0, 0); } @@ -906,17 +906,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testPrechomp_NPE1() { + public void testPrechompNPE1() { StringUtils.prechomp(null, null); } @Test(expected = NullPointerException.class) - public void testPrechomp_NPE2() { + public void testPrechompNPE2() { StringUtils.prechomp("dings", null); } @Test(expected = NullPointerException.class) - public void testPrechomp_NPE3() { + public void testPrechompNPE3() { StringUtils.prechomp(null, "bums"); } @@ -1041,17 +1041,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testRemoveAndHump_NPE1() { + public void testRemoveAndHumpNPE1() { StringUtils.removeAndHump(null, null); } @Test(expected = NullPointerException.class) - public void testRemoveAndHump_NPE2() { + public void testRemoveAndHumpNPE2() { StringUtils.removeAndHump("dings", null); } @Test(expected = NullPointerException.class) - public void testRemoveAndHump_NPE3() { + public void testRemoveAndHumpNPE3() { StringUtils.removeAndHump(null, "bums"); } @@ -1065,7 +1065,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testRemoveDuplicateWhitespace_NPE() { + public void testRemoveDuplicateWhitespaceNPE() { StringUtils.removeDuplicateWhitespace(null); } @@ -1081,12 +1081,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testRepeat_NPE() { + public void testRepeatNPE() { StringUtils.repeat(null, 0); } @Test(expected = NegativeArraySizeException.class) - public void testRepeat_NegativeAmount() { + public void testRepeatNegativeAmount() { StringUtils.repeat("dings", -1); } @@ -1100,7 +1100,7 @@ public class StringUtilsTest { } @Test - public void testReplace_char() { + public void testReplaceChar() { assertThat(StringUtils.replace(null, 'i', 'o'), nullValue()); assertThat(StringUtils.replace("dings", 'i', 'o'), is("dongs")); @@ -1111,7 +1111,7 @@ public class StringUtilsTest { } @Test - public void testReplace2_char_max() { + public void testReplace2CharMax() { assertThat(StringUtils.replace(null, 'i', 'o', 0), nullValue()); assertThat(StringUtils.replace("dingsibumsi", 'i', 'o', 3), is("dongsobumso")); @@ -1126,7 +1126,7 @@ public class StringUtilsTest { } @Test - public void testReplace_string() { + public void testReplaceString() { assertThat(StringUtils.replace(null, "in", "ox"), nullValue()); assertThat(StringUtils.replace("dings", "in", "ox"), is("doxgs")); @@ -1137,7 +1137,7 @@ public class StringUtilsTest { } @Test - public void testReplace2_string_max() { + public void testReplace2StringMax() { assertThat(StringUtils.replace(null, "in", "ox", 0), nullValue()); assertThat(StringUtils.replace("dingsibumsi", "si", "xo", 3), is("dingxobumxo")); @@ -1154,7 +1154,7 @@ public class StringUtilsTest { } @Test - public void testReplaceOnce_char() { + public void testReplaceOnceChar() { assertThat(StringUtils.replaceOnce(null, 'i', 'o'), nullValue()); assertThat(StringUtils.replaceOnce("dingsibumsi", 'i', 'o'), is("dongsibumsi")); @@ -1163,7 +1163,7 @@ public class StringUtilsTest { } @Test - public void testReplaceOnce_string() { + public void testReplaceOnceString() { assertThat(StringUtils.replaceOnce(null, "in", "ox"), nullValue()); assertThat(StringUtils.replaceOnce("dingsibumsi", "si", "xo"), is("dingxobumsi")); @@ -1183,12 +1183,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testReverseDelimitedString_NPE1() { + public void testReverseDelimitedStringNPE1() { StringUtils.reverseDelimitedString(null, null); } @Test(expected = NullPointerException.class) - public void testReverseDelimitedString_NPE2() { + public void testReverseDelimitedStringNPE2() { StringUtils.reverseDelimitedString(null, " "); } @@ -1206,12 +1206,12 @@ public class StringUtilsTest { } @Test(expected = IllegalArgumentException.class) - public void testRight_IAE1() { + public void testRightIAE1() { StringUtils.right(null, -1); } @Test(expected = IllegalArgumentException.class) - public void testRight_IAE2() { + public void testRightIAE2() { StringUtils.right("dings", -1); } @@ -1227,7 +1227,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testRightPad1_NPE() { + public void testRightPad1NPE() { StringUtils.rightPad(null, 0); } @@ -1241,17 +1241,17 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testRightPad2_NPE1() { + public void testRightPad2NPE1() { StringUtils.rightPad(null, 0, null); } @Test(expected = NullPointerException.class) - public void testRightPad2_NPE2() { + public void testRightPad2NPE2() { StringUtils.rightPad("dings", 0, null); } @Test(expected = NullPointerException.class) - public void testRightPad2_NPE23() { + public void testRightPad2NPE23() { StringUtils.rightPad(null, 0, "+"); } @@ -1265,7 +1265,7 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testSplit1_NPE() { + public void testSplit1NPE() { StringUtils.split(null); } @@ -1277,12 +1277,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testSplit2_NPE1() { + public void testSplit2NPE1() { StringUtils.split(null, null); } @Test(expected = NullPointerException.class) - public void testSplit2_NPE2() { + public void testSplit2NPE2() { StringUtils.split(null, " "); } @@ -1298,12 +1298,12 @@ public class StringUtilsTest { } @Test(expected = NullPointerException.class) - public void testSplit3_NPE1() { + public void testSplit3NPE1() { StringUtils.split(null, null, 1); } @Test(expected = NullPointerException.class) - public void testSplit3_NPE2() { + public void testSplit3NPE2() { StringUtils.split(null, " ", 1); } diff --git a/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java b/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java index a61637b..171e8cb 100644 --- a/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java +++ b/src/test/java/org/apache/maven/shared/utils/XmlStreamReaderTest.java @@ -137,7 +137,7 @@ public class XmlStreamReaderTest extends TestCase { checkXmlStreamReader(TEXT_LATIN15, "ISO-8859-15"); } - public void testEUC_JPEncoding() throws IOException { + public void testEUCJPEncoding() throws IOException { checkXmlStreamReader(TEXT_EUC_JP, "EUC-JP"); } diff --git a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java index 7ae03f9..19fbc92 100644 --- a/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/cli/CommandLineUtilsTest.java @@ -91,7 +91,7 @@ public class CommandLineUtilsTest { } @Test - public void givenADoubleQuoteMarkInArgument_whenExecutingCode_thenCommandLineExceptionIsThrown() { + public void givenADoubleQuoteMarkInArgumentWhenExecutingCodeThenCommandLineExceptionIsThrown() { try { new Commandline("echo \"let\"s go\"").execute(); } catch (CommandLineException e) { @@ -102,14 +102,14 @@ public class CommandLineUtilsTest { } @Test - public void givenASingleQuoteMarkInArgument_whenExecutingCode_thenExitCode0Returned() throws Exception { + public void givenASingleQuoteMarkInArgumentWhenExecutingCodeThenExitCode0Returned() throws Exception { final Process p = new Commandline("echo \"let's go\"").execute(); p.waitFor(); assertEquals(0, p.exitValue()); } @Test - public void givenASingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkIsNotEscaped() + public void givenASingleQuoteMarkInArgumentWhenTranslatingToCmdLineArgsThenTheQuotationMarkIsNotEscaped() throws Exception { final String command = "echo \"let's go\""; final String[] expected = new String[] {"echo", "let's go"}; @@ -117,25 +117,23 @@ public class CommandLineUtilsTest { } @Test - public void - givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() - throws Exception { + public void givenAnEscapedDoubleQuoteMarkInArgumentWhenTranslatingToCmdLineArgsThenTheQuotationMarkRemainsEscaped() + throws Exception { final String command = "echo \"let\\\"s go\""; final String[] expected = new String[] {"echo", "let\\\"s go"}; assertCmdLineArgs(expected, command); } @Test - public void - givenAnEscapedSingleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenTheQuotationMarkRemainsEscaped() - throws Exception { + public void givenAnEscapedSingleQuoteMarkInArgumentWhenTranslatingToCmdLineArgsThenTheQuotationMarkRemainsEscaped() + throws Exception { final String command = "echo \"let\\'s go\""; final String[] expected = new String[] {"echo", "let\\'s go"}; assertCmdLineArgs(expected, command); } @Test - public void givenAnEscapedDoubleQuoteMarkInArgument_whenTranslatingToCmdLineArgs_thenNoExceptionIsThrown() + public void givenAnEscapedDoubleQuoteMarkInArgumentWhenTranslatingToCmdLineArgsThenNoExceptionIsThrown() throws Exception { Process p = new Commandline("echo \"let\\\"s go\"").execute(); p.waitFor(); diff --git a/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java b/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java index 7883de7..47a8b1d 100644 --- a/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java +++ b/src/test/java/org/apache/maven/shared/utils/cli/StreamPollFeederTest.java @@ -49,13 +49,13 @@ public class StreamPollFeederTest { @Test public void dataShouldBeCopied() throws InterruptedException, IOException { - StringBuilder TEST_DATA = new StringBuilder(); + StringBuilder testData = new StringBuilder(); for (int i = 0; i < 100; i++) { - TEST_DATA.append("TestData"); + testData.append("TestData"); } ByteArrayInputStream inputStream = - new ByteArrayInputStream(TEST_DATA.toString().getBytes()); + new ByteArrayInputStream(testData.toString().getBytes()); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); StreamPollFeeder streamPollFeeder = new StreamPollFeeder(inputStream, outputStream); @@ -63,7 +63,7 @@ public class StreamPollFeederTest { streamPollFeeder.start(); // wait until all data from steam will be read - while (outputStream.size() < TEST_DATA.length()) { + while (outputStream.size() < testData.length()) { Thread.sleep(100); } @@ -71,6 +71,6 @@ public class StreamPollFeederTest { streamPollFeeder.waitUntilDone(); assertNull(streamPollFeeder.getException()); - assertEquals(TEST_DATA.toString(), outputStream.toString()); + assertEquals(testData.toString(), outputStream.toString()); } } diff --git a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java index c9e9f3c..f05108b 100644 --- a/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java +++ b/src/test/java/org/apache/maven/shared/utils/cli/shell/BourneShellTest.java @@ -41,7 +41,7 @@ public class BourneShellTest extends TestCase { assertEquals("/bin/sh -c cd '/usr/local/bin' && 'chmod'", executable); } - public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes() { + public void testQuoteWorkingDirectoryAndExecutableWDPathWithSingleQuotes() { Shell sh = newShell(); sh.setWorkingDirectory("/usr/local/'something else'"); @@ -52,7 +52,7 @@ public class BourneShellTest extends TestCase { assertEquals("/bin/sh -c cd '/usr/local/'\"'\"'something else'\"'\"'' && 'chmod'", executable); } - public void testQuoteWorkingDirectoryAndExecutable_WDPathWithSingleQuotes_BackslashFileSep() { + public void testQuoteWorkingDirectoryAndExecutableWDPathWithSingleQuotesBackslashFileSep() { Shell sh = newShell(); sh.setWorkingDirectory("\\usr\\local\\'something else'"); diff --git a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java index 5b088c9..c78c3a7 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/FileUtilsTest.java @@ -34,6 +34,7 @@ import java.io.Reader; import java.io.StringReader; import java.io.Writer; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.Arrays; import java.util.HashSet; @@ -361,14 +362,14 @@ public class FileUtilsTest { } /** A time today, rounded down to the previous minute */ - private static long MODIFIED_TODAY = + private static final long MODIFIED_TODAY = (System.currentTimeMillis() / TimeUnit.MINUTES.toMillis(1)) * TimeUnit.MINUTES.toMillis(1); /** A time yesterday, rounded down to the previous minute */ - private static long MODIFIED_YESTERDAY = MODIFIED_TODAY - TimeUnit.DAYS.toMillis(1); + private static final long MODIFIED_YESTERDAY = MODIFIED_TODAY - TimeUnit.DAYS.toMillis(1); /** A time last week, rounded down to the previous minute */ - private static long MODIFIED_LAST_WEEK = MODIFIED_TODAY - TimeUnit.DAYS.toMillis(7); + private static final long MODIFIED_LAST_WEEK = MODIFIED_TODAY - TimeUnit.DAYS.toMillis(7); @Test public void copyFileWithNoFiltersAndNoDestination() throws Exception { @@ -505,7 +506,7 @@ public class FileUtilsTest { private File write(@Nonnull String name, long lastModified, @Nonnull String text) throws IOException { final File file = new File(tempFolder.getRoot(), name); - try (final Writer writer = new FileWriter(file)) { + try (Writer writer = new FileWriter(file)) { writer.write(text); } assertTrue(file.setLastModified(lastModified)); @@ -644,7 +645,7 @@ public class FileUtilsTest { } @Test - public void copyDirectoryErrors_nullDestination() throws IOException { + public void copyDirectoryErrorsNullDestination() throws IOException { try { FileUtils.copyDirectory(new File("a"), null); fail(); @@ -653,7 +654,7 @@ public class FileUtilsTest { } @Test - public void copyDirectoryErrors_copyToSelf() { + public void copyDirectoryErrorsCopyToSelf() { try { FileUtils.copyDirectory(tempFolder.getRoot(), tempFolder.getRoot()); fail(); @@ -872,7 +873,7 @@ public class FileUtilsTest { } @Test - public void writeStringToFileWithEncoding_WithAppendOptionTrue_ShouldNotDeletePreviousFileLines() throws Exception { + public void writeStringToFileWithEncodingWithAppendOptionTrueShouldNotDeletePreviousFileLines() throws Exception { File file = FileTestHelper.newFile(tempFolder, "lines.txt"); FileUtils.fileWrite(file, null, "This line was there before you..."); @@ -884,7 +885,7 @@ public class FileUtilsTest { } @Test - public void writeStringToFile_WithAppendOptionTrue_ShouldNotDeletePreviousFileLines() throws Exception { + public void writeStringToFileWithAppendOptionTrueShouldNotDeletePreviousFileLines() throws Exception { File file = FileTestHelper.newFile(tempFolder, "lines.txt"); FileUtils.fileWrite(file, null, "This line was there before you..."); @@ -900,7 +901,7 @@ public class FileUtilsTest { File file = new File(tempFolder.getRoot(), "writeArray.txt"); FileUtils.fileWriteArray(file, new String[] {"line1", "line2", "line3"}); - byte[] text = "line1\nline2\nline3".getBytes("UTF8"); + byte[] text = "line1\nline2\nline3".getBytes(StandardCharsets.UTF_8); assertEqualContent(text, file); } @@ -909,12 +910,12 @@ public class FileUtilsTest { File file = new File(tempFolder.getRoot(), "writeArray.txt"); FileUtils.fileWriteArray(file, "UTF8", new String[] {"line1", "line2", "line3"}); - byte[] text = "line1\nline2\nline3".getBytes("UTF8"); + byte[] text = "line1\nline2\nline3".getBytes(StandardCharsets.UTF_8); assertEqualContent(text, file); } @Test - public void writeWithEncoding_WithAppendOptionTrue_ShouldNotDeletePreviousFileLines() throws Exception { + public void writeWithEncodingWithAppendOptionTrueShouldNotDeletePreviousFileLines() throws Exception { File file = FileTestHelper.newFile(tempFolder, "lines.txt"); FileUtils.fileWrite(file, "UTF-8", "This line was there before you..."); @@ -926,7 +927,7 @@ public class FileUtilsTest { } @Test - public void write_WithAppendOptionTrue_ShouldNotDeletePreviousFileLines() throws Exception { + public void writeWithAppendOptionTrueShouldNotDeletePreviousFileLines() throws Exception { File file = FileTestHelper.newFile(tempFolder, "lines.txt"); FileUtils.fileWrite(file, null, "This line was there before you..."); diff --git a/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java b/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java index 06d04d9..d5f1c40 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/IOUtilTest.java @@ -1360,9 +1360,9 @@ public class IOUtilTest { @Test public void copyEmptyStringValidOutputStream() throws Exception { - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(emptyString(), OutputStream); - assertThat(OutputStream.toByteArray(), is(emptyString().getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(emptyString(), os); + assertThat(os.toByteArray(), is(emptyString().getBytes())); } @Test(expected = NullPointerException.class) @@ -1374,9 +1374,9 @@ public class IOUtilTest { @Test public void copyStringValidOutputStream() throws Exception { String probe = "A string \u2345\u00ef"; - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(probe, OutputStream); - assertThat(OutputStream.toByteArray(), is(probe.getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(probe, os); + assertThat(os.toByteArray(), is(probe.getBytes())); } @Test(expected = NullPointerException.class) @@ -1396,9 +1396,9 @@ public class IOUtilTest { @Test(expected = NegativeArraySizeException.class) public void copyEmptyStringValidOutputStreamNegBufSz() throws Exception { - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(emptyString(), OutputStream, -1); - assertThat(OutputStream.toByteArray(), is(emptyString().getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(emptyString(), os, -1); + assertThat(os.toByteArray(), is(emptyString().getBytes())); } @Test(expected = NullPointerException.class) @@ -1410,9 +1410,9 @@ public class IOUtilTest { @Test(expected = NegativeArraySizeException.class) public void copyStringValidOutputStreamNegBufSz() throws Exception { String probe = "A string \u2345\u00ef"; - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(probe, OutputStream, -1); - assertThat(OutputStream.toByteArray(), is(probe.getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(probe, os, -1); + assertThat(os.toByteArray(), is(probe.getBytes())); } @Test(expected = NullPointerException.class, timeout = INFINITE_LOOP_TIMEOUT) @@ -1447,9 +1447,9 @@ public class IOUtilTest { @Test public void copyEmptyStringValidOutputStreamPosBufSz() throws Exception { - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(emptyString(), OutputStream, 1); - assertThat(OutputStream.toByteArray(), is(emptyString().getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(emptyString(), os, 1); + assertThat(os.toByteArray(), is(emptyString().getBytes())); } @Test(expected = NullPointerException.class) @@ -1461,9 +1461,9 @@ public class IOUtilTest { @Test public void copyStringValidOutputStreamPosBufSz() throws Exception { String probe = "A string \u2345\u00ef"; - ByteArrayOutputStream OutputStream = new DontCloseByteArrayOutputStream(); - IOUtil.copy(probe, OutputStream, 1); - assertThat(OutputStream.toByteArray(), is(probe.getBytes())); + ByteArrayOutputStream os = new DontCloseByteArrayOutputStream(); + IOUtil.copy(probe, os, 1); + assertThat(os.toByteArray(), is(probe.getBytes())); } @Test(expected = NullPointerException.class) @@ -2284,7 +2284,7 @@ public class IOUtilTest { private static class DontCloseStringReader extends StringReader { - public DontCloseStringReader(String s) { + DontCloseStringReader(String s) { super(s); } @@ -2295,7 +2295,7 @@ public class IOUtilTest { } private static class DontCloseByteArrayInputStream extends ByteArrayInputStream { - public DontCloseByteArrayInputStream(byte[] input) { + DontCloseByteArrayInputStream(byte[] input) { super(input); } diff --git a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java index 5715787..c053294 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternTest.java @@ -20,7 +20,7 @@ package org.apache.maven.shared.utils.io; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; /** * @author Kristian Rosenvold diff --git a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java index 8919d06..2642930 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/MatchPatternsTest.java @@ -20,7 +20,8 @@ package org.apache.maven.shared.utils.io; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * @author Kristian Rosenvold diff --git a/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java b/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java index 52f4da1..0b8a755 100644 --- a/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java +++ b/src/test/java/org/apache/maven/shared/utils/io/SelectorUtilsTest.java @@ -22,7 +22,8 @@ import java.io.File; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * Test the {@link SelectorUtils} class. diff --git a/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java b/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java index f48de3f..15e5697 100644 --- a/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java +++ b/src/test/java/org/apache/maven/shared/utils/logging/AnsiMessageBuilderTest.java @@ -34,63 +34,63 @@ public class AnsiMessageBuilderTest { } @Test - public void should_color_debug() { + public void shouldColorDebug() { ansiMessageBuilder.debug("DEBUG"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;36mDEBUG\u001B[m")); } @Test - public void should_color_info() { + public void shouldColorInfo() { ansiMessageBuilder.info("INFO"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;34mINFO\u001B[m")); } @Test - public void should_color_warning_and_reset() { + public void shouldColorWarningAndReset() { ansiMessageBuilder.warning("WARNING"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;33mWARNING\u001B[m")); } @Test - public void should_color_error() { + public void shouldColorError() { ansiMessageBuilder.error("ERROR"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;31mERROR\u001B[m")); } @Test - public void should_color_success_with_message() { + public void shouldColorSuccessWithMessage() { ansiMessageBuilder.success("a success message"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;32ma success message\u001B[m")); } @Test - public void should_color_failure_and_reset() { + public void shouldColorFailureAndReset() { ansiMessageBuilder.failure("a failure message"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1;31ma failure message\u001B[m")); } @Test - public void should_color_strong_and_reset() { + public void shouldColorStrongAndReset() { ansiMessageBuilder.strong("a strong message"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[1ma strong message\u001B[m")); } @Test - public void should_color_mojo_and_reset() { + public void shouldColorMojoAndReset() { ansiMessageBuilder.mojo("a mojo"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[32ma mojo\u001B[m")); } @Test - public void should_color_project_and_reset() { + public void shouldColorProjectAndReset() { ansiMessageBuilder.project("a project"); assertThat(ansiMessageBuilder.toString(), equalTo("\u001B[36ma project\u001B[m")); diff --git a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java index eb50b07..32f4bb9 100644 --- a/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java +++ b/src/test/java/org/apache/maven/shared/utils/xml/XmlWriterUtilTest.java @@ -154,7 +154,7 @@ public class XmlWriterUtilTest extends TestCase { assertTrue(output.toString().length() >= XmlWriterUtil.DEFAULT_COLUMN_LINE); } - public void testWriteComment_2() throws IOException { + public void testWriteComment2() throws IOException { XmlWriterUtil.writeComment(xmlWriter, "hello\nworld"); writer.close(); StringBuffer sb = new StringBuffer(); @@ -186,7 +186,7 @@ public class XmlWriterUtilTest extends TestCase { XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE); } - public void testWriteComment_3() throws IOException { + public void testWriteComment3() throws IOException { String indent = StringUtils.repeat(" ", 2 * XmlWriterUtil.DEFAULT_INDENTATION_SIZE); XmlWriterUtil.writeComment(xmlWriter, "hello\nworld", 2); writer.close(); @@ -221,7 +221,7 @@ public class XmlWriterUtilTest extends TestCase { assertEquals(output.toString().length(), XmlWriterUtil.DEFAULT_COLUMN_LINE - 1 + "\r\n".length() + 2 * 4); } - public void testWriteCommentXMLWriterStringIntInt_2() throws IOException { + public void testWriteCommentXMLWriterStringIntInt2() throws IOException { String repeat = StringUtils.repeat(" ", 2 * 4); XmlWriterUtil.writeComment(xmlWriter, "hello\nworld", 2, 4); writer.close(); @@ -255,7 +255,7 @@ public class XmlWriterUtilTest extends TestCase { assertEquals(output.toString().length(), 50 - 1 + "\r\n".length() + 2 * 4); } - public void testWriteCommentXMLWriterStringIntIntInt_2() throws IOException { + public void testWriteCommentXMLWriterStringIntIntInt2() throws IOException { String indent = StringUtils.repeat(" ", 2 * 4); XmlWriterUtil.writeComment(xmlWriter, "hello", 2, 4, 10); writer.close(); @@ -287,7 +287,7 @@ public class XmlWriterUtilTest extends TestCase { assertEquals(output.toString().length(), 3 * (80 - 1 + "\r\n".length()) + 2 * "\r\n".length()); } - public void testWriteCommentTextXMLWriterStringInt_2() throws IOException { + public void testWriteCommentTextXMLWriterStringInt2() throws IOException { String indent = StringUtils.repeat(" ", 2 * 2); XmlWriterUtil.writeCommentText( diff --git a/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java b/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java index 939220c..6c6ea17 100644 --- a/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java +++ b/src/test/java/org/apache/maven/shared/utils/xml/pull/Xpp3DomTest.java @@ -26,7 +26,10 @@ import org.apache.maven.shared.utils.xml.Xpp3DomBuilder; import org.junit.Test; import static org.apache.maven.shared.utils.xml.Xpp3Dom.mergeXpp3Dom; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; /** * @author Kristian Rosenvold