From 7e2820730d0614d6328f9581f0df35bb388e6a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louise=20S=C3=B6derstr=C3=B6m?= Date: Fri, 25 Nov 2022 10:26:42 +0100 Subject: [PATCH] [4Bmcyc2U] Un-ignore and clean up working test. I have confirmed locally that this test seems to work fine. --- .../apoc/meta/MetaEnterpriseFeaturesTest.java | 48 ++++++------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/core/src/test/java/apoc/meta/MetaEnterpriseFeaturesTest.java b/core/src/test/java/apoc/meta/MetaEnterpriseFeaturesTest.java index 29b9d59cc3..a57d8cd4a5 100644 --- a/core/src/test/java/apoc/meta/MetaEnterpriseFeaturesTest.java +++ b/core/src/test/java/apoc/meta/MetaEnterpriseFeaturesTest.java @@ -4,7 +4,6 @@ import apoc.util.TestUtil; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.neo4j.driver.Session; @@ -18,6 +17,7 @@ import static apoc.util.TestContainerUtil.testResult; import static apoc.util.TestUtil.isRunningInCI; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeFalse; import static org.junit.Assume.assumeNotNull; import static org.junit.Assume.assumeTrue; @@ -34,12 +34,9 @@ public class MetaEnterpriseFeaturesTest { @BeforeClass public static void beforeAll() { assumeFalse(isRunningInCI()); -// executeGradleTasks("clean", "shadow"); - TestUtil.ignoreException(() -> { - // We build the project, the artifact will be placed into ./build/libs - neo4jContainer = createEnterpriseDB(!TestUtil.isRunningInCI()); - neo4jContainer.start(); - }, Exception.class); + // We build the project, the artifact will be placed into ./build/libs + neo4jContainer = createEnterpriseDB(!TestUtil.isRunningInCI()); + neo4jContainer.start(); assumeNotNull(neo4jContainer); assumeTrue("Neo4j Instance should be up-and-running", neo4jContainer.isRunning()); session = neo4jContainer.getSession(); @@ -53,21 +50,6 @@ public static void afterAll() { } } - public static boolean hasRecordMatching(List> records, Map record) { - return hasRecordMatching(records, row -> { - boolean okSoFar = true; - - for(String k : record.keySet()) { - okSoFar = okSoFar && row.containsKey(k) && - (row.get(k) == null ? - (record.get(k) == null) : - row.get(k).equals(record.get(k))); - } - - return okSoFar; - }); - } - public static boolean hasRecordMatching(List> records, Predicate> predicate) { return records.stream().filter(predicate).count() > 0; } @@ -81,7 +63,6 @@ public static List> gatherRecords(Iterator return rows; } - @Ignore("test fails, ignoring until fixed by upstream author") @Test public void testNodeTypePropertiesBasic() { session.writeTransaction(tx -> { @@ -96,22 +77,23 @@ public void testNodeTypePropertiesBasic() { }); testResult(session, "CALL apoc.meta.nodeTypeProperties();", (r) -> { List> records = gatherRecords(r); - assertEquals(true, hasRecordMatching(records, m -> + assertTrue(hasRecordMatching(records, m -> m.get("nodeType").equals(":`Foo`") && ((List)m.get("nodeLabels")).get(0).equals("Foo") && m.get("propertyName").equals("s") && m.get("mandatory").equals(true))); - assertEquals(true, hasRecordMatching(records, m -> - m.get("propertyName").equals("s") && - ((List)m.get("propertyTypes")).get(0).equals("String"))); + assertTrue(hasRecordMatching(records, m -> + m.get("propertyName").equals("s") && + ((List)m.get("propertyTypes")).get(0).equals("String"))); - assertEquals(true, hasRecordMatching(records, m -> - m.get("nodeType").equals(":`Foo`") && - ((List)m.get("nodeLabels")).get(0).equals("Foo") && - m.get("propertyName").equals("dl") && - m.get("mandatory").equals(false))); - assertEquals(5, records.size()); + assertTrue(hasRecordMatching(records, m -> + m.get("nodeType").equals(":`Foo`") && + ((List)m.get("nodeLabels")).get(0).equals("Foo") && + m.get("propertyName").equals("dl") && + m.get("mandatory").equals(false))); + + assertEquals(5, records.size()); }); } }