Skip to content
This repository was archived by the owner on Feb 12, 2019. It is now read-only.

Commit d6e1a06

Browse files
committed
fixes delete query convert test
1 parent fdf3dc1 commit d6e1a06

File tree

1 file changed

+8
-69
lines changed

1 file changed

+8
-69
lines changed

artemis-graph/src/test/java/org/jnosql/artemis/graph/query/DeleteQueryConverterTest.java

Lines changed: 8 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void shouldRunQuery1(String methodName) {
7676
@ParameterizedTest(name = "Should parser the query {0}")
7777
@ValueSource(strings = {"deleteByNameNotEquals"})
7878
public void shouldRunQuery2(String methodName) {
79-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
79+
Method method = Stream.of(PersonRepository.class.getMethods())
8080
.filter(m -> m.getName().equals(methodName)).findFirst().get();
8181

8282
graph.addVertex("Person").property("name", "Otavio");
@@ -95,7 +95,7 @@ public void shouldRunQuery2(String methodName) {
9595
@ParameterizedTest(name = "Should parser the query {0}")
9696
@ValueSource(strings = {"deleteByAgeLessThan"})
9797
public void shouldRunQuery3(String methodName) {
98-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
98+
Method method = Stream.of(PersonRepository.class.getMethods())
9999
.filter(m -> m.getName().equals(methodName)).findFirst().get();
100100

101101
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -113,7 +113,7 @@ public void shouldRunQuery3(String methodName) {
113113
@ParameterizedTest(name = "Should parser the query {0}")
114114
@ValueSource(strings = {"deleteByAgeLessThanEqual"})
115115
public void shouldRunQuery4(String methodName) {
116-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
116+
Method method = Stream.of(PersonRepository.class.getMethods())
117117
.filter(m -> m.getName().equals(methodName)).findFirst().get();
118118

119119
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -133,7 +133,7 @@ public void shouldRunQuery4(String methodName) {
133133
@ParameterizedTest(name = "Should parser the query {0}")
134134
@ValueSource(strings = {"deleteByAgeGreaterThan"})
135135
public void shouldRunQuery5(String methodName) {
136-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
136+
Method method = Stream.of(PersonRepository.class.getMethods())
137137
.filter(m -> m.getName().equals(methodName)).findFirst().get();
138138

139139
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -151,7 +151,7 @@ public void shouldRunQuery5(String methodName) {
151151
@ParameterizedTest(name = "Should parser the query {0}")
152152
@ValueSource(strings = {"deleteByAgeGreaterThanEqual"})
153153
public void shouldRunQuery6(String methodName) {
154-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
154+
Method method = Stream.of(PersonRepository.class.getMethods())
155155
.filter(m -> m.getName().equals(methodName)).findFirst().get();
156156

157157
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -170,7 +170,7 @@ public void shouldRunQuery6(String methodName) {
170170
@ParameterizedTest(name = "Should parser the query {0}")
171171
@ValueSource(strings = {"deleteByAgeBetween"})
172172
public void shouldRunQuery7(String methodName) {
173-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
173+
Method method = Stream.of(PersonRepository.class.getMethods())
174174
.filter(m -> m.getName().equals(methodName)).findFirst().get();
175175

176176
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -187,71 +187,10 @@ public void shouldRunQuery7(String methodName) {
187187
}
188188

189189

190-
@ParameterizedTest(name = "Should parser the query {0}")
191-
@ValueSource(strings = {"deleteByAgeLessThanOrderByName"})
192-
public void shouldRunQuery8(String methodName) {
193-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
194-
.filter(m -> m.getName().equals(methodName)).findFirst().get();
195-
196-
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
197-
graph.addVertex(T.label, "Person", "name", "Ada", "age", 40);
198-
graph.addVertex(T.label, "Person", "name", "Poliana", "age", 25);
199-
ClassRepresentation representation = representations.get(Person.class);
200-
GraphQueryMethod queryMethod = new GraphQueryMethod(representation, graph.traversal().V(),
201-
converters, method, new Object[]{100});
202-
203-
List<Vertex> vertices = converter.apply(queryMethod);
204-
List<Object> names = vertices.stream().map(v -> v.value("name"))
205-
.collect(Collectors.toList());
206-
assertEquals(3, vertices.size());
207-
MatcherAssert.assertThat(names, Matchers.contains("Ada", "Otavio", "Poliana"));
208-
}
209-
210-
211-
@ParameterizedTest(name = "Should parser the query {0}")
212-
@ValueSource(strings = {"deleteByAgeLessThanOrderByNameDesc"})
213-
public void shouldRunQuery9(String methodName) {
214-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
215-
.filter(m -> m.getName().equals(methodName)).findFirst().get();
216-
217-
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
218-
graph.addVertex(T.label, "Person", "name", "Ada", "age", 40);
219-
graph.addVertex(T.label, "Person", "name", "Poliana", "age", 25);
220-
ClassRepresentation representation = representations.get(Person.class);
221-
GraphQueryMethod queryMethod = new GraphQueryMethod(representation, graph.traversal().V(),
222-
converters, method, new Object[]{100});
223-
224-
List<Vertex> vertices = converter.apply(queryMethod);
225-
List<Object> names = vertices.stream().map(v -> v.value("name"))
226-
.collect(Collectors.toList());
227-
assertEquals(3, vertices.size());
228-
MatcherAssert.assertThat(names, Matchers.contains("Poliana", "Otavio", "Ada"));
229-
}
230-
231-
@ParameterizedTest(name = "Should parser the query {0}")
232-
@ValueSource(strings = {"deleteByAgeLessThanOrderByNameDescAgeAsc"})
233-
public void shouldRunQuery10(String methodName) {
234-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
235-
.filter(m -> m.getName().equals(methodName)).findFirst().get();
236-
237-
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
238-
graph.addVertex(T.label, "Person", "name", "Ada", "age", 40);
239-
graph.addVertex(T.label, "Person", "name", "Poliana", "age", 25);
240-
ClassRepresentation representation = representations.get(Person.class);
241-
GraphQueryMethod queryMethod = new GraphQueryMethod(representation, graph.traversal().V(),
242-
converters, method, new Object[]{100});
243-
244-
List<Vertex> vertices = converter.apply(queryMethod);
245-
List<Object> names = vertices.stream().map(v -> v.value("name"))
246-
.collect(Collectors.toList());
247-
assertEquals(3, vertices.size());
248-
MatcherAssert.assertThat(names, Matchers.contains("Poliana", "Otavio", "Ada"));
249-
}
250-
251190
@ParameterizedTest(name = "Should parser the query {0}")
252191
@ValueSource(strings = {"deleteByAgeIn"})
253192
public void shouldRunQuery11(String methodName) {
254-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
193+
Method method = Stream.of(PersonRepository.class.getMethods())
255194
.filter(m -> m.getName().equals(methodName)).findFirst().get();
256195

257196
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);
@@ -272,7 +211,7 @@ public void shouldRunQuery11(String methodName) {
272211
@ParameterizedTest(name = "Should parser the query {0}")
273212
@ValueSource(strings = {"deleteByNameIn"})
274213
public void shouldRunQuery12(String methodName) {
275-
Method method = Stream.of(SelectQueryConverterTest.PersonRepository.class.getMethods())
214+
Method method = Stream.of(PersonRepository.class.getMethods())
276215
.filter(m -> m.getName().equals(methodName)).findFirst().get();
277216

278217
graph.addVertex(T.label, "Person", "name", "Otavio", "age", 30);

0 commit comments

Comments
 (0)