use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class ColumnRepositoryProxyTest 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));
vendorRepository.findByPrefixesIn(singletonList("prefix"));
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());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class ColumnRepositoryProxyTest 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));
vendorRepository.findByPrefixes("prefix");
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());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class DefaultDocumentEntityConverterTest method shouldConvertAndDoNotUseUnmodifiableCollection.
@Test
public void shouldConvertAndDoNotUseUnmodifiableCollection() {
DocumentEntity entity = DocumentEntity.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());
}
use of jakarta.nosql.tck.entities.Vendor in project jnosql-diana by eclipse.
the class DocumentRepositoryProxyPaginationTest method shouldFindByIn.
@Test
public void shouldFindByIn() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(DocumentQuery.class))).thenReturn(Stream.of(vendor));
Pagination pagination = getPagination();
vendorRepository.findByPrefixesIn(Collections.singletonList("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(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 DocumentRepositoryProxyTest method shouldFindByIn.
@Test
public void shouldFindByIn() {
Vendor vendor = new Vendor("vendor");
vendor.setPrefixes(Collections.singleton("prefix"));
when(template.select(any(DocumentQuery.class))).thenReturn(Stream.of(vendor));
vendorRepository.findByPrefixesIn(singletonList("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(IN, condition.getCondition());
}
Aggregations