Skip to content

Commit 9d69776

Browse files
committed
test: update test on graph
Signed-off-by: Otavio Santana <[email protected]>
1 parent a567c88 commit 9d69776

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

jnosql-tinkerpop/src/test/java/org/eclipse/jnosql/databases/tinkerpop/mapping/AbstractGraphTemplateTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void shouldExecuteQuery() {
408408
.withName("Otavio").build();
409409
getGraphTemplate().insert(human);
410410
List<Human> people = getGraphTemplate()
411-
.<Human>gremlin("g.V().hasLabel('Person')")
411+
.<Human>gremlin("g.V().hasLabel('Human')")
412412
.toList();
413413
assertThat(people.stream().map(Human::getName).collect(toList())).contains("Otavio");
414414
}
@@ -424,7 +424,7 @@ void shouldReturnOneElement() {
424424
Human otavio = Human.builder().withAge()
425425
.withName("Otavio").build();
426426
getGraphTemplate().insert(otavio);
427-
Optional<Human> person = getGraphTemplate().gremlinSingleResult("g.V().hasLabel('Person')");
427+
Optional<Human> person = getGraphTemplate().gremlinSingleResult("g.V().hasLabel('Human')");
428428
assertTrue(person.isPresent());
429429
}
430430

@@ -433,14 +433,14 @@ void shouldReturnErrorWhenHasNoneThanOneElement() {
433433

434434
getGraphTemplate().insert(Human.builder().withAge().withName("Otavio").build());
435435
getGraphTemplate().insert(Human.builder().withAge().withName("Poliana").build());
436-
assertThrows(NonUniqueResultException.class, () -> getGraphTemplate().gremlinSingleResult("g.V().hasLabel('Person')"));
436+
assertThrows(NonUniqueResultException.class, () -> getGraphTemplate().gremlinSingleResult("g.V().hasLabel('Human')"));
437437
}
438438

439439
@Test
440440
void shouldExecutePrepareStatement() {
441441
getGraphTemplate().insert(Human.builder().withAge().withName("Otavio").build());
442442
PreparedStatement prepare = getGraphTemplate().gremlinPrepare("g.V().hasLabel(@param)");
443-
prepare.bind("param", "Person");
443+
prepare.bind("param", "Human");
444444
List<Human> people = prepare.<Human>result().toList();
445445
assertThat(people.stream().map(Human::getName).collect(toList())).contains("Otavio");
446446
}
@@ -449,7 +449,7 @@ void shouldExecutePrepareStatement() {
449449
void shouldExecutePrepareStatementSingleton() {
450450
getGraphTemplate().insert(Human.builder().withAge().withName("Otavio").build());
451451
PreparedStatement prepare = getGraphTemplate().gremlinPrepare("g.V().hasLabel(@param)");
452-
prepare.bind("param", "Person");
452+
prepare.bind("param", "Human");
453453
Optional<Human> otavio = prepare.singleResult();
454454
assertTrue(otavio.isPresent());
455455
}
@@ -467,15 +467,15 @@ void shouldExecutePrepareStatementWithErrorWhenThereIsMoreThanOneResult() {
467467
getGraphTemplate().insert(Human.builder().withAge().withName("Otavio").build());
468468
getGraphTemplate().insert(Human.builder().withAge().withName("Poliana").build());
469469
PreparedStatement prepare = getGraphTemplate().gremlinPrepare("g.V().hasLabel(@param)");
470-
prepare.bind("param", "Person");
470+
prepare.bind("param", "Human");
471471
assertThrows(NonUniqueResultException.class, prepare::singleResult);
472472
}
473473

474474
@Test
475475
void shouldCount() {
476476
getGraphTemplate().insert(Human.builder().withAge().withName("Otavio").build());
477477
getGraphTemplate().insert(Human.builder().withAge().withName("Poliana").build());
478-
assertEquals(2L, getGraphTemplate().count("Person"));
478+
assertEquals(2L, getGraphTemplate().count("Human"));
479479
}
480480

481481
@Test

jnosql-tinkerpop/src/test/java/org/eclipse/jnosql/databases/tinkerpop/mapping/DefaultValueMapTraversalTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void shouldReturnOptionalEmptyWhenThereIsNotResultInSingleResult() {
100100
@Test
101101
void shouldReturnSingleResult() {
102102
String name = "Poliana";
103-
Optional<Map<String, Object>> poliana = graphTemplate.traversalVertex().hasLabel("Person").
103+
Optional<Map<String, Object>> poliana = graphTemplate.traversalVertex().hasLabel("Human").
104104
has("name", name).valueMap("name").singleResult();
105105
assertEquals(name, poliana.map(m -> m.get("name")).orElse(""));
106106
}

jnosql-tinkerpop/src/test/java/org/eclipse/jnosql/databases/tinkerpop/mapping/DefaultVertexTraversalTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void shouldReturnErrorWhenHasKeyIsNull() {
175175

176176
@Test
177177
void shouldHaveLabel() {
178-
List<Magazine> magazines = graphTemplate.traversalVertex().hasLabel("Book").<Magazine>result().collect(toList());
178+
List<Magazine> magazines = graphTemplate.traversalVertex().hasLabel("Magazine").<Magazine>result().collect(toList());
179179
assertEquals(3, magazines.size());
180180
assertThat(magazines).contains(shack, license, effectiveJava);
181181
}
@@ -184,7 +184,7 @@ void shouldHaveLabel() {
184184
void shouldHaveLabel2() {
185185

186186
List<Object> entities = graphTemplate.traversalVertex()
187-
.hasLabel(P.eq("Book").or(P.eq("Person")))
187+
.hasLabel(P.eq("Magazine").or(P.eq("Human")))
188188
.result().collect(toList());
189189
assertThat(entities).hasSize(6).contains(shack, license, effectiveJava, otavio, poliana, paulo);
190190
}
@@ -272,7 +272,7 @@ void shouldDefinesRange() {
272272

273273
@Test
274274
void shouldMapValuesAsStream() {
275-
List<Map<String, Object>> maps = graphTemplate.traversalVertex().hasLabel("Person")
275+
List<Map<String, Object>> maps = graphTemplate.traversalVertex().hasLabel("Human")
276276
.valueMap("name").stream().toList();
277277

278278
assertFalse(maps.isEmpty());
@@ -287,7 +287,7 @@ void shouldMapValuesAsStream() {
287287

288288
@Test
289289
void shouldMapValuesAsStreamLimit() {
290-
List<Map<String, Object>> maps = graphTemplate.traversalVertex().hasLabel("Person")
290+
List<Map<String, Object>> maps = graphTemplate.traversalVertex().hasLabel("Human")
291291
.valueMap("name").next(2).toList();
292292

293293
assertFalse(maps.isEmpty());
@@ -304,7 +304,7 @@ void shouldReturnMapValueAsEmptyStream() {
304304

305305
@Test
306306
void shouldReturnNext() {
307-
Map<String, Object> map = graphTemplate.traversalVertex().hasLabel("Person")
307+
Map<String, Object> map = graphTemplate.traversalVertex().hasLabel("Human")
308308
.valueMap("name").next();
309309

310310
assertNotNull(map);
@@ -403,7 +403,7 @@ void shouldOrderAsc() {
403403
String property = "name";
404404

405405
List<String> properties = graphTemplate.traversalVertex()
406-
.hasLabel("Book")
406+
.hasLabel("Magazine")
407407
.has(property)
408408
.orderBy(property)
409409
.asc().<Magazine>result()
@@ -418,7 +418,7 @@ void shouldOrderDesc() {
418418
String property = "name";
419419

420420
List<String> properties = graphTemplate.traversalVertex()
421-
.hasLabel("Book")
421+
.hasLabel("Magazine")
422422
.has(property)
423423
.orderBy(property)
424424
.desc().<Magazine>result()
@@ -452,15 +452,15 @@ void shouldReturnHasLabel() {
452452

453453
@Test
454454
void shouldReturnResultAsList() {
455-
List<Human> people = graphTemplate.traversalVertex().hasLabel("Person")
455+
List<Human> people = graphTemplate.traversalVertex().hasLabel("Human")
456456
.<Human>result()
457457
.toList();
458458
assertEquals(3, people.size());
459459
}
460460

461461
@Test
462462
void shouldReturnErrorWhenThereAreMoreThanOneInGetSingleResult() {
463-
assertThrows(NonUniqueResultException.class, () -> graphTemplate.traversalVertex().hasLabel("Person").singleResult());
463+
assertThrows(NonUniqueResultException.class, () -> graphTemplate.traversalVertex().hasLabel("Human").singleResult());
464464
}
465465

466466
@Test
@@ -472,7 +472,7 @@ void shouldReturnOptionalEmptyWhenThereIsNotResultInSingleResult() {
472472
@Test
473473
void shouldReturnSingleResult() {
474474
String name = "Poliana";
475-
Optional<Human> poliana = graphTemplate.traversalVertex().hasLabel("Person").
475+
Optional<Human> poliana = graphTemplate.traversalVertex().hasLabel("Human").
476476
has("name", name).singleResult();
477477
assertEquals(name, poliana.map(Human::getName).orElse(""));
478478
}

0 commit comments

Comments
 (0)