AbstractParserTest: Use CONSTANT_CASE for static final field

Change-Id: Ica831987e94fda4e7d365c5e2f0c920416dd5a07
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2017-04-06 11:11:25 +02:00
committed by David Pursehouse
parent fc555d7854
commit 8cc3363c9d
5 changed files with 37 additions and 37 deletions

View File

@@ -27,7 +27,7 @@ import org.junit.Ignore;
@Ignore @Ignore
public class AbstractParserTest { public class AbstractParserTest {
protected static final String changeURL = "https://gerrit-review.googlesource.com/#/changes/123"; protected static final String CHANGE_URL = "https://gerrit-review.googlesource.com/#/changes/123";
protected static void assertChangeMessage(String message, MailComment comment) { protected static void assertChangeMessage(String message, MailComment comment) {
assertThat(comment.fileName).isNull(); assertThat(comment.fileName).isNull();

View File

@@ -30,7 +30,7 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ "<blockquote class=\"quote\" " + "<blockquote class=\"quote\" "
+ "<p>foobar <strong>posted comments</strong> on this change.</p>" + "<p>foobar <strong>posted comments</strong> on this change.</p>"
+ "<p><a href=\"" + "<p><a href=\""
+ changeURL + CHANGE_URL
+ "/1\" " + "/1\" "
+ "target=\"_blank\">View Change</a></p><div>Patch Set 2: CR-1\n" + "target=\"_blank\">View Change</a></p><div>Patch Set 2: CR-1\n"
+ "\n" + "\n"
@@ -38,13 +38,13 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ "<p>" + "<p>"
+ // File #1: test.txt + // File #1: test.txt
"<a href=\"" "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\">" + "/1/gerrit-server/test.txt\">"
+ "File gerrit-server/<wbr>test.txt:</a></p>" + "File gerrit-server/<wbr>test.txt:</a></p>"
+ commentBlock(f1) + commentBlock(f1)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\">" + "/1/gerrit-server/test.txt\">"
+ "Patch Set #2:</a> </p>" + "Patch Set #2:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -53,7 +53,7 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ commentBlock(fc1) + commentBlock(fc1)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@2\">" + "/1/gerrit-server/test.txt@2\">"
+ "Patch Set #2, Line 31:</a> </p>" + "Patch Set #2, Line 31:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -64,7 +64,7 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ // Inline comment #2 + // Inline comment #2
"<li><p>" "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@3\">" + "/1/gerrit-server/test.txt@3\">"
+ "Patch Set #2, Line 47:</a> </p>" + "Patch Set #2, Line 47:</a> </p>"
+ "<blockquote><pre>Some comment posted on Gerrit</pre>" + "<blockquote><pre>Some comment posted on Gerrit</pre>"
@@ -73,7 +73,7 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ commentBlock(c2) + commentBlock(c2)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@115\">" + "/1/gerrit-server/test.txt@115\">"
+ "Patch Set #2, Line 115:</a> <code>some code</code></p>" + "Patch Set #2, Line 115:</a> <code>some code</code></p>"
+ "<p>some comment</p></li></ul></li>" + "<p>some comment</p></li></ul></li>"
@@ -81,13 +81,13 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ "<li><p>" + "<li><p>"
+ // File #2: test.txt + // File #2: test.txt
"<a href=\"" "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt\">" + "/1/gerrit-server/readme.txt\">"
+ "File gerrit-server/<wbr>readme.txt:</a></p>" + "File gerrit-server/<wbr>readme.txt:</a></p>"
+ commentBlock(f2) + commentBlock(f2)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt@3\">" + "/1/gerrit-server/readme.txt@3\">"
+ "Patch Set #2, Line 31:</a> </p>" + "Patch Set #2, Line 31:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -100,7 +100,7 @@ public class GenericHtmlParserTest extends HtmlParserTest {
+ "" + ""
+ // Footer + // Footer
"<p>To view, visit <a href=\"" "<p>To view, visit <a href=\""
+ changeURL + CHANGE_URL
+ "/1\">this change</a>. " + "/1\">this change</a>. "
+ "To unsubscribe, visit <a href=\"https://someurl\">settings</a>." + "To unsubscribe, visit <a href=\"https://someurl\">settings</a>."
+ "</p><p>Gerrit-MessageType: comment<br>" + "</p><p>Gerrit-MessageType: comment<br>"

View File

@@ -29,7 +29,7 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ "<blockquote class=\"gmail_quote\" " + "<blockquote class=\"gmail_quote\" "
+ "<p>foobar <strong>posted comments</strong> on this change.</p>" + "<p>foobar <strong>posted comments</strong> on this change.</p>"
+ "<p><a href=\"" + "<p><a href=\""
+ changeURL + CHANGE_URL
+ "/1\" " + "/1\" "
+ "target=\"_blank\">View Change</a></p><div>Patch Set 2: CR-1\n" + "target=\"_blank\">View Change</a></p><div>Patch Set 2: CR-1\n"
+ "\n" + "\n"
@@ -37,13 +37,13 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ "<p>" + "<p>"
+ // File #1: test.txt + // File #1: test.txt
"<a href=\"" "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\">" + "/1/gerrit-server/test.txt\">"
+ "File gerrit-server/<wbr>test.txt:</a></p>" + "File gerrit-server/<wbr>test.txt:</a></p>"
+ commentBlock(f1) + commentBlock(f1)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\">" + "/1/gerrit-server/test.txt\">"
+ "Patch Set #2:</a> </p>" + "Patch Set #2:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -52,7 +52,7 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ commentBlock(fc1) + commentBlock(fc1)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@2\">" + "/1/gerrit-server/test.txt@2\">"
+ "Patch Set #2, Line 31:</a> </p>" + "Patch Set #2, Line 31:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -63,7 +63,7 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ // Inline comment #2 + // Inline comment #2
"<li><p>" "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@3\">" + "/1/gerrit-server/test.txt@3\">"
+ "Patch Set #2, Line 47:</a> </p>" + "Patch Set #2, Line 47:</a> </p>"
+ "<blockquote><pre>Some comment posted on Gerrit</pre>" + "<blockquote><pre>Some comment posted on Gerrit</pre>"
@@ -72,7 +72,7 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ commentBlock(c2) + commentBlock(c2)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@115\">" + "/1/gerrit-server/test.txt@115\">"
+ "Patch Set #2, Line 115:</a> <code>some code</code></p>" + "Patch Set #2, Line 115:</a> <code>some code</code></p>"
+ "<p>some comment</p></li></ul></li>" + "<p>some comment</p></li></ul></li>"
@@ -80,13 +80,13 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ "<li><p>" + "<li><p>"
+ // File #2: test.txt + // File #2: test.txt
"<a href=\"" "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt\">" + "/1/gerrit-server/readme.txt\">"
+ "File gerrit-server/<wbr>readme.txt:</a></p>" + "File gerrit-server/<wbr>readme.txt:</a></p>"
+ commentBlock(f2) + commentBlock(f2)
+ "<li><p>" + "<li><p>"
+ "<a href=\"" + "<a href=\""
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt@3\">" + "/1/gerrit-server/readme.txt@3\">"
+ "Patch Set #2, Line 31:</a> </p>" + "Patch Set #2, Line 31:</a> </p>"
+ "<blockquote><pre>Some inline comment from Gerrit</pre>" + "<blockquote><pre>Some inline comment from Gerrit</pre>"
@@ -99,7 +99,7 @@ public class GmailHtmlParserTest extends HtmlParserTest {
+ "" + ""
+ // Footer + // Footer
"<p>To view, visit <a href=\"" "<p>To view, visit <a href=\""
+ changeURL + CHANGE_URL
+ "/1\">this change</a>. " + "/1\">this change</a>. "
+ "To unsubscribe, visit <a href=\"https://someurl\">settings</a>." + "To unsubscribe, visit <a href=\"https://someurl\">settings</a>."
+ "</p><p>Gerrit-MessageType: comment<br>" + "</p><p>Gerrit-MessageType: comment<br>"

View File

@@ -49,7 +49,7 @@ public abstract class HtmlParserTest extends AbstractParserTest {
null)); null));
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(3); assertThat(parsedComments).hasSize(3);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -71,7 +71,7 @@ public abstract class HtmlParserTest extends AbstractParserTest {
null)); null));
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(3); assertThat(parsedComments).hasSize(3);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -85,7 +85,7 @@ public abstract class HtmlParserTest extends AbstractParserTest {
b.htmlContent(newHtmlBody(null, null, null, null, null, null, null)); b.htmlContent(newHtmlBody(null, null, null, null, null, null, null));
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).isEmpty(); assertThat(parsedComments).isEmpty();
} }
@@ -98,7 +98,7 @@ public abstract class HtmlParserTest extends AbstractParserTest {
null, null, null, "Also have a comment here.", "This is a nice file", null, null)); null, null, null, "Also have a comment here.", "This is a nice file", null, null));
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = HtmlParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(2); assertThat(parsedComments).hasSize(2);
assertFileComment("This is a nice file", parsedComments.get(0), comments.get(1).key.filename); assertFileComment("This is a nice file", parsedComments.get(0), comments.get(1).key.filename);

View File

@@ -40,7 +40,7 @@ public class TextParserTest extends AbstractParserTest {
b.textContent("Looks good to me\n" + quotedFooter); b.textContent("Looks good to me\n" + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(1); assertThat(parsedComments).hasSize(1);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -61,7 +61,7 @@ public class TextParserTest extends AbstractParserTest {
+ quotedFooter); + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(3); assertThat(parsedComments).hasSize(3);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -84,7 +84,7 @@ public class TextParserTest extends AbstractParserTest {
+ quotedFooter); + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(3); assertThat(parsedComments).hasSize(3);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -98,7 +98,7 @@ public class TextParserTest extends AbstractParserTest {
b.textContent(newPlaintextBody(null, null, null, null, null, null, null) + quotedFooter); b.textContent(newPlaintextBody(null, null, null, null, null, null, null) + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).isEmpty(); assertThat(parsedComments).isEmpty();
} }
@@ -112,7 +112,7 @@ public class TextParserTest extends AbstractParserTest {
+ quotedFooter); + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(2); assertThat(parsedComments).hasSize(2);
assertFileComment("This is a nice file", parsedComments.get(0), comments.get(1).key.filename); assertFileComment("This is a nice file", parsedComments.get(0), comments.get(1).key.filename);
@@ -135,7 +135,7 @@ public class TextParserTest extends AbstractParserTest {
.replace("> ", ">> ")); .replace("> ", ">> "));
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(3); assertThat(parsedComments).hasSize(3);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -158,7 +158,7 @@ public class TextParserTest extends AbstractParserTest {
+ quotedFooter); + quotedFooter);
List<Comment> comments = defaultComments(); List<Comment> comments = defaultComments();
List<MailComment> parsedComments = TextParser.parse(b.build(), comments, changeURL); List<MailComment> parsedComments = TextParser.parse(b.build(), comments, CHANGE_URL);
assertThat(parsedComments).hasSize(2); assertThat(parsedComments).hasSize(2);
assertChangeMessage("Looks good to me", parsedComments.get(0)); assertChangeMessage("Looks good to me", parsedComments.get(0));
@@ -184,7 +184,7 @@ public class TextParserTest extends AbstractParserTest {
+ "<noreply-gerritcodereview-qUgXfQecoDLHwp0MldAzig@google.com> wrote: \n" + "<noreply-gerritcodereview-qUgXfQecoDLHwp0MldAzig@google.com> wrote: \n"
+ "> Foo Bar has posted comments on this change. ( \n" + "> Foo Bar has posted comments on this change. ( \n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1 )\n" + "/1 )\n"
+ "> \n" + "> \n"
+ "> Change subject: Test change\n" + "> Change subject: Test change\n"
@@ -196,7 +196,7 @@ public class TextParserTest extends AbstractParserTest {
+ "> (3 comments)\n" + "> (3 comments)\n"
+ "> \n" + "> \n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\n" + "/1/gerrit-server/test.txt\n"
+ "> File \n" + "> File \n"
+ "> gerrit-server/test.txt:\n" + "> gerrit-server/test.txt:\n"
@@ -204,14 +204,14 @@ public class TextParserTest extends AbstractParserTest {
+ "> \n" + "> \n"
+ "> Patch Set #4:\n" + "> Patch Set #4:\n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt\n" + "/1/gerrit-server/test.txt\n"
+ "> \n" + "> \n"
+ "> Some comment" + "> Some comment"
+ "> \n" + "> \n"
+ (fc1 == null ? "" : fc1 + "\n") + (fc1 == null ? "" : fc1 + "\n")
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@2\n" + "/1/gerrit-server/test.txt@2\n"
+ "> PS1, Line 2: throw new Exception(\"Object has unsupported: \" +\n" + "> PS1, Line 2: throw new Exception(\"Object has unsupported: \" +\n"
+ "> : entry.getValue() +\n" + "> : entry.getValue() +\n"
@@ -222,7 +222,7 @@ public class TextParserTest extends AbstractParserTest {
+ ">\n" + ">\n"
+ "> \n" + "> \n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/test.txt@3\n" + "/1/gerrit-server/test.txt@3\n"
+ "> PS1, Line 3: throw new Exception(\"Object has: \" +\n" + "> PS1, Line 3: throw new Exception(\"Object has: \" +\n"
+ "> : entry.getValue().getClass() +\n" + "> : entry.getValue().getClass() +\n"
@@ -232,14 +232,14 @@ public class TextParserTest extends AbstractParserTest {
+ (c2 == null ? "" : c2 + "\n") + (c2 == null ? "" : c2 + "\n")
+ "> \n" + "> \n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt\n" + "/1/gerrit-server/readme.txt\n"
+ "> File \n" + "> File \n"
+ "> gerrit-server/readme.txt:\n" + "> gerrit-server/readme.txt:\n"
+ (f2 == null ? "" : f2 + "\n") + (f2 == null ? "" : f2 + "\n")
+ "> \n" + "> \n"
+ "> " + "> "
+ changeURL + CHANGE_URL
+ "/1/gerrit-server/readme.txt@3\n" + "/1/gerrit-server/readme.txt@3\n"
+ "> PS1, Line 3: E\n" + "> PS1, Line 3: E\n"
+ "> Should this be EEE like in other places?\n" + "> Should this be EEE like in other places?\n"