Skip to content

Commit

Permalink
feat: update mapping api
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Apr 10, 2024
1 parent bee6781 commit 4f50949
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ void shouldInsertLong(){
@Test
void shouldInsertPersonIterable(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(people))).thenReturn(people);
Iterable<Person> result = this.personRepository.insertIterable(people);
assertThat(result).isNotNull().contains(person);
Expand All @@ -364,7 +364,7 @@ void shouldInsertPersonIterable(){
@Test
void shouldInsertPersonIterableVoid(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(people))).thenReturn(people);
this.personRepository.insertIterableVoid(people);
Mockito.verify(template).insert(eq(people));
Expand All @@ -373,7 +373,7 @@ void shouldInsertPersonIterableVoid(){
@Test
void shouldInsertPersonIterableInt(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(people))).thenReturn(people);
var result = this.personRepository.insertIterableInt(people);
Mockito.verify(template).insert(eq(people));
Expand All @@ -383,7 +383,7 @@ void shouldInsertPersonIterableInt(){
@Test
void shouldInsertPersonIterableLong(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(people))).thenReturn(people);
var result = this.personRepository.insertIterableLong(people);
Mockito.verify(template).insert(eq(people));
Expand Down Expand Up @@ -469,7 +469,7 @@ void shouldUpdateLong(){
@Test
void shouldUpdatePersonIterable(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.update(eq(people))).thenReturn(people);
Iterable<Person> result = this.personRepository.updateIterable(people);
assertThat(result).isNotNull().contains(person);
Expand All @@ -479,7 +479,7 @@ void shouldUpdatePersonIterable(){
@Test
void shouldUpdatePersonIterableVoid(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.update(eq(people))).thenReturn(people);
this.personRepository.updateIterableVoid(people);
Mockito.verify(template).update(eq(people));
Expand All @@ -488,7 +488,7 @@ void shouldUpdatePersonIterableVoid(){
@Test
void shouldUpdatePersonIterableInt(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.update(eq(people))).thenReturn(people);
int result = this.personRepository.updateIterableInt(people);
Mockito.verify(template).update(eq(people));
Expand All @@ -498,7 +498,7 @@ void shouldUpdatePersonIterableInt(){
@Test
void shouldUpdatePersonIterableLong(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.update(eq(people))).thenReturn(people);
var result = this.personRepository.updateIterableLong(people);
Mockito.verify(template).update(eq(people));
Expand Down Expand Up @@ -584,7 +584,7 @@ void shouldSaveLong(){
@Test
void shouldSavePersonIterable(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(person))).thenReturn(person);
Iterable<Person> result = this.personRepository.saveIterable(people);
assertThat(result).isNotNull().contains(person);
Expand All @@ -594,7 +594,7 @@ void shouldSavePersonIterable(){
@Test
void shouldSavePersonIterableVoid(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(person))).thenReturn(person);
this.personRepository.saveIterableVoid(people);
Mockito.verify(template).insert(eq(person));
Expand All @@ -603,7 +603,7 @@ void shouldSavePersonIterableVoid(){
@Test
void shouldSavePersonIterableInt(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(person))).thenReturn(person);
var result = this.personRepository.saveIterableInt(people);
Mockito.verify(template).insert(eq(person));
Expand All @@ -613,7 +613,7 @@ void shouldSavePersonIterableInt(){
@Test
void shouldSavePersonIterableLong(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
when(template.insert(eq(person))).thenReturn(person);
var result = this.personRepository.saveIterableLong(people);
Mockito.verify(template).insert(eq(person));
Expand Down Expand Up @@ -690,7 +690,7 @@ void shouldDeleteLong(){
@Test
void shouldDeletePersonIterable(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
var result = this.personRepository.deleteIterable(people);
assertThat(result).isTrue();
Mockito.verify(template).delete(Person.class, person.getId());
Expand All @@ -699,15 +699,15 @@ void shouldDeletePersonIterable(){
@Test
void shouldDeletePersonIterableVoid(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
this.personRepository.deleteIterableVoid(people);
Mockito.verify(template).delete(Person.class, person.getId());
}

@Test
void shouldDeletePersonIterableInt(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
var result = this.personRepository.deleteIterableInt(people);
Mockito.verify(template).delete(Person.class, person.getId());
Assertions.assertThat(result).isEqualTo(1);
Expand All @@ -716,7 +716,7 @@ void shouldDeletePersonIterableInt(){
@Test
void shouldDeletePersonIterableLong(){
Person person = ada();
Set<Person> people = Collections.singleton(person);
List<Person> people = Collections.singletonList(person);
var result = this.personRepository.deleteIterableLong(people);
Mockito.verify(template).delete(Person.class, person.getId());
Assertions.assertThat(result).isEqualTo(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ public interface PersonRepository extends NoSQLRepository<Person, Long> {
long insertPersonLong(Person person);

@Insert
Iterable<Person> insertIterable(Iterable<Person> people);
List<Person> insertIterable(List<Person> people);

@Insert
void insertIterableVoid(Iterable<Person> people);
void insertIterableVoid(List<Person> people);

@Insert
int insertIterableInt(Iterable<Person> people);
int insertIterableInt(List<Person> people);

@Insert
long insertIterableLong(Iterable<Person> people);
long insertIterableLong(List<Person> people);

@Insert
Person[] insertArray(Person[] people);
Expand All @@ -93,16 +93,16 @@ public interface PersonRepository extends NoSQLRepository<Person, Long> {
long savePersonLong(Person person);

@Save
Iterable<Person> saveIterable(Iterable<Person> people);
List<Person> saveIterable(List<Person> people);

@Save
void saveIterableVoid(Iterable<Person> people);
void saveIterableVoid(List<Person> people);

@Save
int saveIterableInt(Iterable<Person> people);
int saveIterableInt(List<Person> people);

@Save
long saveIterableLong(Iterable<Person> people);
long saveIterableLong(List<Person> people);

@Save
Person[] saveArray(Person[] people);
Expand All @@ -129,16 +129,16 @@ public interface PersonRepository extends NoSQLRepository<Person, Long> {
long updatePersonLong(Person person);

@Update
Iterable<Person> updateIterable(Iterable<Person> people);
List<Person> updateIterable(List<Person> people);

@Update
void updateIterableVoid(Iterable<Person> people);
void updateIterableVoid(List<Person> people);

@Update
int updateIterableInt(Iterable<Person> people);
int updateIterableInt(List<Person> people);

@Update
long updateIterableLong(Iterable<Person> people);
long updateIterableLong(List<Person> people);

@Update
Person[] updateArray(Person[] people);
Expand All @@ -161,16 +161,16 @@ public interface PersonRepository extends NoSQLRepository<Person, Long> {
int deletePersonInt(Person person);

@Delete
boolean deleteIterable(Iterable<Person> people);
boolean deleteIterable(List<Person> people);

@Delete
void deleteIterableVoid(Iterable<Person> people);
void deleteIterableVoid(List<Person> people);

@Delete
int deleteIterableInt(Iterable<Person> people);
int deleteIterableInt(List<Person> people);

@Delete
long deleteIterableLong(Iterable<Person> people);
long deleteIterableLong(List<Person> people);

@Delete
boolean deleteArray(Person[] people);
Expand Down
Loading

0 comments on commit 4f50949

Please sign in to comment.