Skip to content

Commit

Permalink
[NOID] applied code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 committed Mar 10, 2024
1 parent ee2f12c commit 91e3749
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
45 changes: 29 additions & 16 deletions full/src/test/java/apoc/load/LoadHtmlTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.junit.After;
import org.junit.Assert;
Expand All @@ -52,23 +51,29 @@
public class LoadHtmlTest {

protected static final List<Map<String, Object>> RESULT_QUERY_METADATA = asList(
map("tagName", "meta", "attributes", map("charset", "UTF-8")),
map("attributes", map("name", "ResourceLoaderDynamicStyles"), "tagName", "meta"),
map("attributes", map("name", "generator", "content", "MediaWiki 1.32.0-wmf.18"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin-when-crossorigin"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin-when-cross-origin"), "tagName", "meta"),
map("attributes", map("property", "og:image", "content", "https://upload.wikimedia.org/wikipedia/en/e/ea/Aap_Kaa_Hak_titles.jpg"), "tagName", "meta")
);
map("tagName", "meta", "attributes", map("charset", "UTF-8")),
map("attributes", map("name", "ResourceLoaderDynamicStyles"), "tagName", "meta"),
map("attributes", map("name", "generator", "content", "MediaWiki 1.32.0-wmf.18"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin-when-crossorigin"), "tagName", "meta"),
map("attributes", map("name", "referrer", "content", "origin-when-cross-origin"), "tagName", "meta"),
map(
"attributes",
map(
"property",
"og:image",
"content",
"https://upload.wikimedia.org/wikipedia/en/e/ea/Aap_Kaa_Hak_titles.jpg"),
"tagName",
"meta"));

protected static final List<Map<String, Object>> RESULT_QUERY_H2 = asList(
map("text", "Contents", "tagName", "h2"),
map("text", "Origins[edit]", "tagName", "h2"),
map("text", "Content[edit]", "tagName", "h2"),
map("text", "Legacy[edit]", "tagName", "h2"),
map("text", "References[edit]", "tagName", "h2"),
map("text", "Navigation menu", "tagName", "h2")
);
map("text", "Navigation menu", "tagName", "h2"));

private static final String INVALID_PATH = new File("src/test/resources/wikipedia1.html").getName();
private static final String VALID_PATH =
Expand Down Expand Up @@ -474,8 +479,7 @@ public void testQueryWithFailsSilentlyWithList() {

List<Map<String, Object>> expectedH6 = asList(
map("attributes", map("id", "correct"), "text", "test", "tagName", "h6"),
map("attributes", map("id", "childIncorrect"), "text", "incorrecttest", "tagName", "h6")
);
map("attributes", map("id", "childIncorrect"), "text", "incorrecttest", "tagName", "h6"));

testResult(
db,
Expand All @@ -499,8 +503,15 @@ public void testQueryWithFailsSilentlyWithListAndChildren() {

List<Map<String, Object>> expectedH6 = asList(
map("children", asList(), "attributes", map("id", "correct"), "text", "test", "tagName", "h6"),
map("children", asList(), "attributes", map("id", "childIncorrect"), "text", "incorrect", "tagName", "h6")
);
map(
"children",
asList(),
"attributes",
map("id", "childIncorrect"),
"text",
"incorrect",
"tagName",
"h6"));

testResult(
db,
Expand Down Expand Up @@ -645,7 +656,9 @@ public static void skipIfBrowserNotPresentOrCompatible(Runnable runnable) {

// The test don't fail if the current chrome/firefox version is incompatible or if the browser is not
// installed
Stream<String> notPresentOrIncompatible = Stream.of("cannot find Chrome binary", "Cannot find firefox binary",
Stream<String> notPresentOrIncompatible = Stream.of(
"cannot find Chrome binary",
"Cannot find firefox binary",
"Expected browser binary location",
"browser start-up failure",
"This version of ChromeDriver only supports Chrome version");
Expand Down
4 changes: 2 additions & 2 deletions full/src/test/java/apoc/load/LoadHtmlTestParameterized.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testQueryAll() {

List<Map<String, Object>> metadata = (List<Map<String, Object>>) value.get("metadata");
List<Map<String, Object>> h2 = (List<Map<String, Object>>) value.get("h2");

assertEquals(RESULT_QUERY_METADATA, metadata);
assertEquals(RESULT_QUERY_H2, h2);
});
Expand Down Expand Up @@ -126,7 +126,7 @@ public void testQueryH2WithConfig() {
config),
result -> {
Map<String, Object> row = result.next();
assertEquals(map("h2",RESULT_QUERY_H2), row.get("value"));
assertEquals(map("h2", RESULT_QUERY_H2), row.get("value"));
assertFalse(result.hasNext());
});
});
Expand Down

0 comments on commit 91e3749

Please sign in to comment.