Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Lint cleanups in PostToolTest (#2668)

Eric Pugh1df769c5679c
diff --git a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
index 0f8b9f1559e..d415435940d 100644
--- a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
+++ b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
@@ -25,7 +25,6 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -256,7 +255,7 @@ public class PostToolTest extends SolrCloudTestCase {
}
@Test
- public void testAppendUrlPath() throws URISyntaxException {
+ public void testAppendUrlPath() {
assertEquals(
URI.create("http://[ff01::114]/a?foo=bar"),
PostTool.appendUrlPath(URI.create("http://[ff01::114]?foo=bar"), "/a"));
@@ -288,7 +287,7 @@ public class PostToolTest extends SolrCloudTestCase {
}
@Test
- public void testDoFilesMode() throws MalformedURLException {
+ public void testDoFilesMode() {
PostTool postTool = new PostTool();
postTool.recursive = 0;
postTool.dryRun = true;
@@ -310,7 +309,7 @@ public class PostToolTest extends SolrCloudTestCase {
}
@Test
- public void testRecursionAppliesToFilesMode() throws MalformedURLException {
+ public void testRecursionAppliesToFilesMode() {
PostTool postTool = new PostTool();
postTool.recursive = 1; // This is the default
postTool.dryRun = true;
@@ -405,17 +404,15 @@ public class PostToolTest extends SolrCloudTestCase {
linkMap.put("http://[ff01::114]/page2", s);
// Simulate a robots.txt file with comments and a few disallows
- StringBuilder sb = new StringBuilder();
- sb.append(
- "# Comments appear after the \"#\" symbol at the start of a line, or after a directive\n");
- sb.append("User-agent: * # match all bots\n");
- sb.append("Disallow: # This is void\n");
- sb.append("Disallow: /disallow # Disallow this path\n");
- sb.append("Disallow: /nonexistentpath # Disallow this path\n");
+ String sb =
+ "# Comments appear after the \"#\" symbol at the start of a line, or after a directive\n"
+ + "User-agent: * # match all bots\n"
+ + "Disallow: # This is void\n"
+ + "Disallow: /disallow # Disallow this path\n"
+ + "Disallow: /nonexistentpath # Disallow this path\n";
this.robotsCache.put(
"[ff01::114]",
- super.parseRobotsTxt(
- new ByteArrayInputStream(sb.toString().getBytes(StandardCharsets.UTF_8))));
+ super.parseRobotsTxt(new ByteArrayInputStream(sb.getBytes(StandardCharsets.UTF_8))));
}
@Override