Skip to content

Commit a086bf5

Browse files
committed
feat: update arangodb entities
Signed-off-by: Otavio Santana <[email protected]>
1 parent 1f7f32c commit a086bf5

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/integration/ArangoDBTemplateIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ void shouldSelectCursorSize() {
208208
var book = new Magazine(randomUUID().toString(), "Effective Java", index);
209209
template.insert(book);
210210
}
211-
var select = SelectQuery.select().from("Book").orderBy("edition").asc()
211+
var select = SelectQuery.select().from("Magazine").orderBy("edition").asc()
212212
.skip(4).limit(3).build();
213213
var pageRequest = PageRequest.ofSize(3);
214214
CursoredPage<Magazine> entities = template.selectCursor(select, pageRequest);

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/mapping/ArangoDBDocumentRepositoryProxyTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ public void setUp() {
7171
ArangoDBDocumentRepositoryProxy handler = new ArangoDBDocumentRepositoryProxy<>(template,
7272
PersonRepository.class, converters, entitiesMetadata);
7373

74-
when(template.insert(any(Person.class))).thenReturn(new Person());
75-
when(template.insert(any(Person.class), any(Duration.class))).thenReturn(new Person());
76-
when(template.update(any(Person.class))).thenReturn(new Person());
74+
when(template.insert(any(Human.class))).thenReturn(new Human());
75+
when(template.insert(any(Human.class), any(Duration.class))).thenReturn(new Human());
76+
when(template.update(any(Human.class))).thenReturn(new Human());
7777
this.personRepository = (PersonRepository) Proxy.newProxyInstance(PersonRepository.class.getClassLoader(),
7878
new Class[]{PersonRepository.class},
7979
handler);
@@ -98,32 +98,32 @@ public void shouldFindByNameAQL() {
9898

9999
@Test
100100
public void shouldSaveUsingInsert() {
101-
Person person = Person.of("Ada", 10);
102-
personRepository.save(person);
103-
verify(template).insert(eq(person));
101+
Human human = Human.of("Ada", 10);
102+
personRepository.save(human);
103+
verify(template).insert(eq(human));
104104
}
105105

106106

107107
@Test
108108
public void shouldSaveUsingUpdate() {
109-
Person person = Person.of("Ada-2", 10);
110-
when(template.find(Person.class, "Ada-2")).thenReturn(Optional.of(person));
111-
personRepository.save(person);
112-
verify(template).update(eq(person));
109+
Human human = Human.of("Ada-2", 10);
110+
when(template.find(Human.class, "Ada-2")).thenReturn(Optional.of(human));
111+
personRepository.save(human);
112+
verify(template).update(eq(human));
113113
}
114114

115115
@Test
116116
public void shouldDelete(){
117117
personRepository.deleteById("id");
118-
verify(template).delete(Person.class, "id");
118+
verify(template).delete(Human.class, "id");
119119
}
120120

121121

122122
@Test
123123
public void shouldDeleteEntity(){
124-
Person person = Person.of("Ada", 10);
125-
personRepository.delete(person);
126-
verify(template).delete(Person.class, person.getName());
124+
Human human = Human.of("Ada", 10);
125+
personRepository.delete(human);
126+
verify(template).delete(Human.class, human.getName());
127127
}
128128

129129
@Test
@@ -134,16 +134,16 @@ public void shouldDeleteAll() {
134134
verify(template).deleteAll(queryCaptor.capture());
135135

136136
Class<?> query = queryCaptor.getValue();
137-
Assertions.assertThat(query).isEqualTo(Person.class);
137+
Assertions.assertThat(query).isEqualTo(Human.class);
138138
}
139139

140140

141-
interface PersonRepository extends ArangoDBRepository<Person, String> {
141+
interface PersonRepository extends ArangoDBRepository<Human, String> {
142142

143143
@AQL("FOR p IN Person RETURN p")
144-
List<Person> findAllQuery();
144+
List<Human> findAllQuery();
145145

146146
@AQL("FOR p IN Person FILTER p.name = @name RETURN p")
147-
List<Person> findByName(@Param("name") String name);
147+
List<Human> findByName(@Param("name") String name);
148148
}
149149
}

jnosql-arangodb/src/test/java/org/eclipse/jnosql/databases/arangodb/mapping/ArangoDBExtensionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public class ArangoDBExtensionTest {
3939

4040
@Inject
41-
private PersonRepository repository;
41+
private HumanRepository repository;
4242

4343
@Test
4444
public void shouldSave() {
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Objects;
2323

2424
@Entity
25-
public class Person {
25+
public class Human {
2626

2727
@Id("_key")
2828
private String name;
@@ -46,21 +46,21 @@ public void setAge(Integer age) {
4646
this.age = age;
4747
}
4848

49-
public Person(String name, Integer age) {
49+
public Human(String name, Integer age) {
5050
this.name = name;
5151
this.age = age;
5252
}
5353

54-
public Person() {
54+
public Human() {
5555
}
5656

5757
@Override
5858
public boolean equals(Object o) {
5959
if (this == o) return true;
6060
if (o == null || getClass() != o.getClass()) return false;
61-
Person person = (Person) o;
62-
return Objects.equals(name, person.name) &&
63-
Objects.equals(age, person.age);
61+
Human human = (Human) o;
62+
return Objects.equals(name, human.name) &&
63+
Objects.equals(age, human.age);
6464
}
6565

6666
@Override
@@ -76,7 +76,7 @@ public String toString() {
7676
'}';
7777
}
7878

79-
public static Person of(String name, Integer age) {
80-
return new Person(name, age);
79+
public static Human of(String name, Integer age) {
80+
return new Human(name, age);
8181
}
8282
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
import jakarta.data.repository.Repository;
1919

2020
@Repository
21-
public interface PersonRepository extends ArangoDBRepository<Person, String> {
21+
public interface HumanRepository extends ArangoDBRepository<Human, String> {
2222
}

0 commit comments

Comments
 (0)