public void testAddEdgePropertyWithIllegalValueForSecondaryIndex()

in hugegraph-test/src/main/java/org/apache/hugegraph/core/EdgeCoreTest.java [5854:5953]


    public void testAddEdgePropertyWithIllegalValueForSecondaryIndex() {
        HugeGraph graph = graph();
        initStrikeIndex();

        Vertex louise = graph.addVertex(T.label, "person", "name", "Louise",
                                        "city", "Beijing", "age", 21);
        Vertex sean = graph.addVertex(T.label, "person", "name", "Sean",
                                      "city", "Beijing", "age", 23);
        graph.tx().commit();

        long current = System.currentTimeMillis();
        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0000", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u0' " +
                                  "in index property:",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0001", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u1' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0002", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u2' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0003", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u3' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0000a", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u0' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0001a", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u1' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0002a", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u2' in index",
                                  e.getMessage());
        });

        Assert.assertThrows(IllegalArgumentException.class, () -> {
            louise.addEdge("strike", sean, "id", 4,
                           "timestamp", current, "place", "park",
                           "tool", "\u0003a", "reason", "jeer",
                           "arrested", false);
            graph.tx().commit();
        }, e -> {
            Assert.assertContains("Illegal leading char '\\u3' in index",
                                  e.getMessage());
        });
    }