Skip to content

Commit

Permalink
improves in in the mapper query
Browse files Browse the repository at this point in the history
  • Loading branch information
otaviojava committed May 23, 2020
1 parent 22810c7 commit 893f409
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import javax.inject.Inject;
import java.math.BigDecimal;
import java.util.Arrays;

import static jakarta.nosql.column.ColumnQuery.select;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -137,6 +138,16 @@ public void shouldSelectWhereNameBetween() {
assertEquals(queryExpected, query);
}

@Test
public void shouldSelectWhereNameIn() {
ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("id")
.in(Arrays.asList("Ada", "Poliana")).build();
ColumnQuery queryExpected = select().from("Person").where("_id")
.in(Arrays.asList("Ada", "Poliana")).build();
assertEquals(queryExpected, query);
}


@Test
public void shouldSelectWhereNameNot() {
ColumnQuery query = mapperBuilder.selectFrom(Person.class).where("name").not().like("Ada").build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import javax.inject.Inject;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Optional;
import java.util.stream.Stream;

Expand Down Expand Up @@ -138,6 +139,15 @@ public void shouldSelectWhereNameBetween() {
assertEquals(queryExpected, query);
}

@Test
public void shouldSelectWhereNameIn() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("id")
.in(Arrays.asList("Ada", "Poliana")).build();
DocumentQuery queryExpected = select().from("Person").where("_id")
.in(Arrays.asList("Ada", "Poliana")).build();
assertEquals(queryExpected, query);
}

@Test
public void shouldSelectWhereNameNot() {
DocumentQuery query = mapperBuilder.selectFrom(Person.class).where("name").not().like("Ada").build();
Expand Down

0 comments on commit 893f409

Please sign in to comment.