use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentTemplateTest method shouldDelete.
@Test
public void shouldDelete() {
DocumentDeleteQuery query = delete().from("delete").build();
subject.delete(query);
verify(managerMock).delete(query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").between(10, 20).build();
DocumentDeleteQuery queryExpected = delete().from("Person").where("_id").between(10L, 20L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldExecuteDelete.
@Test
public void shouldExecuteDelete() {
DocumentTemplate template = Mockito.mock(DocumentTemplate.class);
ArgumentCaptor<DocumentDeleteQuery> queryCaptor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
mapperBuilder.deleteFrom(Person.class).delete(template);
Mockito.verify(template).delete(queryCaptor.capture());
DocumentDeleteQuery query = queryCaptor.getValue();
DocumentDeleteQuery queryExpected = delete().from("Person").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldUseAttributeConverter.
@Test
public void shouldUseAttributeConverter() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Worker.class).where("salary").eq(new Money("USD", BigDecimal.TEN)).build();
DocumentDeleteQuery queryExpected = delete().from("Worker").where("money").eq("USD 10").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldQueryBySubEntity.
@Test
public void shouldQueryBySubEntity() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Address.class).where("zipCode.zip").eq("01312321").build();
DocumentDeleteQuery queryExpected = delete().from("Address").where("zipCode.zip").eq("01312321").build();
assertEquals(queryExpected, query);
}
Aggregations