use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class DocumentRepositoryProxyPaginationTest method shouldFindByStringWhenFieldIsSet.
@Test
public void shouldFindByStringWhenFieldIsSet() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(DocumentQuery.class))).thenReturn(Stream.of(vendor));
Pagination pagination = getPagination();
vendorRepository.findByPrefixes("prefix", pagination);
ArgumentCaptor<DocumentQuery> captor = ArgumentCaptor.forClass(DocumentQuery.class);
verify(template).singleResult(captor.capture());
DocumentQuery query = captor.getValue();
DocumentCondition condition = query.getCondition().get();
assertEquals("vendors", query.getDocumentCollection());
assertEquals(EQUALS, condition.getCondition());
assertEquals(Document.of("prefixes", "prefix"), condition.getDocument());
assertEquals(pagination.getSkip(), query.getSkip());
assertEquals(pagination.getLimit(), query.getLimit());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class DocumentRepositoryProxyTest method shouldFindByStringWhenFieldIsSet.
@Test
public void shouldFindByStringWhenFieldIsSet() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(DocumentQuery.class))).thenReturn(Stream.of(vendor));
vendorRepository.findByPrefixes("prefix");
ArgumentCaptor<DocumentQuery> captor = ArgumentCaptor.forClass(DocumentQuery.class);
verify(template).singleResult(captor.capture());
DocumentQuery query = captor.getValue();
DocumentCondition condition = query.getCondition().get();
assertEquals("vendors", query.getDocumentCollection());
assertEquals(EQUALS, condition.getCondition());
assertEquals(Document.of("prefixes", "prefix"), condition.getDocument());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class ColumnRepositoryProxyPaginationTest method shouldFindByStringWhenFieldIsSet.
@Test
public void shouldFindByStringWhenFieldIsSet() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(ColumnQuery.class))).thenReturn(Stream.of(vendor));
Pagination pagination = getPagination();
vendorRepository.findByPrefixes("prefix", pagination);
ArgumentCaptor<ColumnQuery> captor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(template).singleResult(captor.capture());
ColumnQuery query = captor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("vendors", query.getColumnFamily());
assertEquals(EQUALS, condition.getCondition());
assertEquals(Column.of("prefixes", "prefix"), condition.getColumn());
assertEquals(pagination.getSkip(), query.getSkip());
assertEquals(pagination.getLimit(), query.getLimit());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class ColumnRepositoryProxyPaginationTest method shouldFindByIn.
@Test
public void shouldFindByIn() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(ColumnQuery.class))).thenReturn(Stream.of(vendor));
Pagination pagination = getPagination();
vendorRepository.findByPrefixesIn(singletonList("prefix"), pagination);
ArgumentCaptor<ColumnQuery> captor = ArgumentCaptor.forClass(ColumnQuery.class);
verify(template).singleResult(captor.capture());
ColumnQuery query = captor.getValue();
ColumnCondition condition = query.getCondition().get();
assertEquals("vendors", query.getColumnFamily());
assertEquals(IN, condition.getCondition());
assertEquals(pagination.getSkip(), query.getSkip());
assertEquals(pagination.getLimit(), query.getLimit());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class DefaultColumnEntityConverterTest method shouldConvertAndDoNotUseUnmodifiableCollection.
@Test
public void shouldConvertAndDoNotUseUnmodifiableCollection() {
ColumnEntity entity = ColumnEntity.of("vendors");
entity.add("name", "name");
entity.add("prefixes", Arrays.asList("value", "value2"));
Vendor vendor = converter.toEntity(entity);
vendor.add("value3");
Assertions.assertEquals(3, vendor.getPrefixes().size());
}
Aggregations