From 5c52a3933792d1453021ba0bfdd2443e1b42fe05 Mon Sep 17 00:00:00 2001 From: Tomas Bjerre Date: Sun, 6 Sep 2020 07:24:56 +0200 Subject: [PATCH] Moving PatchParser from violation-comments-lib #95 --- .../util/{PatchParser.java => PatchParserUtil.java} | 4 ++-- .../{PatchParserTest.java => PatchParserUtilTest.java} | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) rename src/main/java/se/bjurr/violations/lib/util/{PatchParser.java => PatchParserUtil.java} (96%) rename src/test/java/se/bjurr/violations/lib/util/{PatchParserTest.java => PatchParserUtilTest.java} (95%) diff --git a/src/main/java/se/bjurr/violations/lib/util/PatchParser.java b/src/main/java/se/bjurr/violations/lib/util/PatchParserUtil.java similarity index 96% rename from src/main/java/se/bjurr/violations/lib/util/PatchParser.java rename to src/main/java/se/bjurr/violations/lib/util/PatchParserUtil.java index 243c0297..079c4c6c 100644 --- a/src/main/java/se/bjurr/violations/lib/util/PatchParser.java +++ b/src/main/java/se/bjurr/violations/lib/util/PatchParserUtil.java @@ -9,7 +9,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -public class PatchParser { +public class PatchParserUtil { private static final Pattern RANGE_PATTERN = Pattern.compile( @@ -18,7 +18,7 @@ public class PatchParser { private final Map> newLineToOldLineTable; private final Map> newLineToLineInDiffTable; - public PatchParser(String patchString) { + public PatchParserUtil(String patchString) { newLineToOldLineTable = new TreeMap<>(); newLineToLineInDiffTable = new TreeMap<>(); if (patchString == null) { diff --git a/src/test/java/se/bjurr/violations/lib/util/PatchParserTest.java b/src/test/java/se/bjurr/violations/lib/util/PatchParserUtilTest.java similarity index 95% rename from src/test/java/se/bjurr/violations/lib/util/PatchParserTest.java rename to src/test/java/se/bjurr/violations/lib/util/PatchParserUtilTest.java index 3bc57b22..e615bc72 100644 --- a/src/test/java/se/bjurr/violations/lib/util/PatchParserTest.java +++ b/src/test/java/se/bjurr/violations/lib/util/PatchParserUtilTest.java @@ -7,8 +7,8 @@ import java.util.logging.Logger; import org.junit.Test; -public class PatchParserTest { - private static Logger LOG = Logger.getLogger(PatchParser.class.getSimpleName()); +public class PatchParserUtilTest { + private static Logger LOG = Logger.getLogger(PatchParserUtil.class.getSimpleName()); private static final String NEW_DIFF = "@@ -1,6 +1,6 @@\n \n \n \n-\n+ \n \n "; @@ -63,7 +63,7 @@ public void testThatOldLineIsEmptyIfOutsideOfDiff() { getIntegerOptionalMap(patch); - final PatchParser pp = new PatchParser(patch); + final PatchParserUtil pp = new PatchParserUtil(patch); assertThat(pp.isLineInDiff(999)) // .isFalse(); @@ -124,7 +124,7 @@ public void testThatLineTableCanBeRetrieved2() { private Integer findLineToComment(String patch, int commentLint) { getIntegerOptionalMap(patch); - return new PatchParser(patch) // + return new PatchParserUtil(patch) // .findLineInDiff(commentLint) // .orElse(null); } @@ -136,7 +136,7 @@ private Map> getIntegerOptionalMap(final String patch sb.append(i + 1 + " | " + diffLines[i] + "\n"); } final Map> map = - new PatchParser(patch) // + new PatchParserUtil(patch) // .getNewLineToOldLineTable(); for (Map.Entry> e : map.entrySet()) { sb.append(e.getKey() + " : " + e.getValue().orElse(null) + "\n");