GitHub user dosubot[bot] added a comment to the discussion: Get a notify every 
time some add/delete/update operation is performed on graph.

<!-- Answer -->
To write a simple test case in HugeGraph that creates a schema and adds some 
vertices with properties, you can follow this example:

```java
import org.junit.Before;
import org.junit.Test;
import org.apache.hugegraph.structure.constant.T;
import org.apache.hugegraph.structure.graph.Vertex;
import org.apache.hugegraph.testutil.Assert;
import com.google.common.collect.ImmutableMap;

public class SimpleVertexTest extends BaseFuncTest {

    @Override
    @Before
    public void setup() {
        BaseClientTest.initPropertyKey();
        BaseClientTest.initVertexLabel();
    }

    @Test
    public void testCreateVertex() {
        Vertex james = graph().addVertex(T.LABEL, "person", "name", "James",
                                         "city", "Beijing", "age", 19);
        Map<String, Object> props = ImmutableMap.of("name", "James",
                                                    "city", "Beijing",
                                                    "age", 19);
        Assert.assertEquals(props, james.properties());
    }
}
```

- **setup**: This method initializes the schema by setting up property keys and 
vertex labels.
- **testCreateVertex**: This test method creates a vertex with the label 
"person" and properties "name", "city", and "age". It then verifies that the 
properties of the created vertex match the expected values.

This code snippet demonstrates how to create a schema and add vertices with 
properties in a test case using HugeGraph 
<sup>[[1]](https://github.com/apache/incubator-hugegraph-toolchain/blob/master/hugegraph-client/src/test/java/org/apache/hugegraph/functional/VertexTest.java)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*

---
<sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/bb96d6f7-6db3-4d9c-a1ac-0aaefb02c990?feedback_type=other)</sup>


GitHub link: 
https://github.com/apache/incubator-hugegraph/discussions/2738#discussioncomment-12316633

----
This is an automatically sent email for dev@hugegraph.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@hugegraph.apache.org

Reply via email to